0

我有以下简单的代码来发送电子邮件:

server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

但是,消息永远不会被发送。我添加了“set_debuglevel”行以尝试排除故障,但输出对我来说意义不大:

send: 'ehlo [127.0.1.1]\r\n'
reply: '250-ubuntu\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 10240000\r\n'
reply: '250-VRFY\r\n'
reply: '250-ETRN\r\n'
reply: '250-STARTTLS\r\n'
reply: '250-ENHANCEDSTATUSCODES\r\n'
reply: '250-8BITMIME\r\n'
reply: '250 DSN\r\n'
reply: retcode (250); Msg: ubuntu
PIPELINING
SIZE 10240000
VRFY
ETRN
STARTTLS
ENHANCEDSTATUSCODES
8BITMIME
DSN
send: 'mail FROM:<info@foobarconsulting.com> size=337\r\n'
reply: '250 2.1.0 Ok\r\n'
reply: retcode (250); Msg: 2.1.0 Ok
send: 'rcpt TO:<adam@foobarconsulting.com>\r\n'
reply: '250 2.1.5 Ok\r\n'
reply: retcode (250); Msg: 2.1.5 Ok
send: 'data\r\n'
reply: '354 End data with <CR><LF>.<CR><LF>\r\n'
reply: retcode (354); Msg: End data with <CR><LF>.<CR><LF>
data: (354, 'End data with <CR><LF>.<CR><LF>')
send: 'Hello!\r\n\r\nThe below URLs are either broken or taking too long to respond:\r\nhttp://www.google.com/does-not-exist/\r\nhttp://www.cnn.com/does-not-exist\r\n\r\nLog in and navigate to http://blahblah.com/wp-admin to update the content.\r\n\r\nThanks,\r\n\r\nYour friends at Foo Bar Consulting\r\n.\r\n'
reply: '250 2.0.0 Ok: queued as E7B8820144\r\n'
reply: retcode (250); Msg: 2.0.0 Ok: queued as E7B8820144
data: (250, '2.0.0 Ok: queued as E7B8820144')
send: 'quit\r\n'
reply: '221 2.0.0 Bye\r\n'
reply: retcode (221); Msg: 2.0.0 Bye

我已经安装了 postfix(我相信它是在我使用标准 LAMP 包设置我的 Ubuntu 时默认安装的)但我不知道还能去哪里寻求帮助。

任何见解或想法将不胜感激。

4

1 回答 1

0
  1. you might want to check out sendmail's log

  2. make sure your local DNS works. try ping foobarconsulting.com

于 2012-06-10T17:44:57.413 回答