Postfix 发送电子邮件时挂起

发布于 2024-09-17 20:40:29 字数 1583 浏览 11 评论 0原文

如果我尝试按如下方式发送电子邮件,则进程会挂起并且没有任何反应:

>>> from django.core.management import setup_environ
>>> from cube import settings
>>> setup_environ(settings)
'cube'
>>> from django.core.mail import send_mail
>>> send_mail('Subject', 'Message', '[email protected]', ['[email protected]'], fail_silently=False)

但是,通过 telnet 到端口 25 工作得很好

$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^]

telnet> 

,这是以防万一

$ netstat -a | grep :smtp
tcp        0      0 *:smtp                  *:*                     LISTEN     
tcp        0      0 localhost:smtp          localhost:44932         ESTABLISHED
tcp        0      0 localhost:44932         localhost:smtp          ESTABLISHED
tcp        0      0 localhost:smtp          localhost:60964         ESTABLISHED
tcp        0      0 localhost:60964         localhost:smtp          ESTABLISHED
tcp        0      0 localhost:37247         localhost:smtp          FIN_WAIT2  
tcp        1      0 localhost:smtp          localhost:37247         CLOSE_WAIT 
tcp        9      0 localhost:smtp          localhost:37245         CLOSE_WAIT 

我运行 Ubuntu 10.04 和 Python 2.6.5

我不知道在哪里查看接下来找出问题所在。请帮我。谢谢。

If I try to send an email as follows, the process hangs and nothing happens:

>>> from django.core.management import setup_environ
>>> from cube import settings
>>> setup_environ(settings)
'cube'
>>> from django.core.mail import send_mail
>>> send_mail('Subject', 'Message', '[email protected]', ['[email protected]'], fail_silently=False)

However, doing telnet to port 25 works just fine

$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
^]

telnet> 

and here's this just in case

$ netstat -a | grep :smtp
tcp        0      0 *:smtp                  *:*                     LISTEN     
tcp        0      0 localhost:smtp          localhost:44932         ESTABLISHED
tcp        0      0 localhost:44932         localhost:smtp          ESTABLISHED
tcp        0      0 localhost:smtp          localhost:60964         ESTABLISHED
tcp        0      0 localhost:60964         localhost:smtp          ESTABLISHED
tcp        0      0 localhost:37247         localhost:smtp          FIN_WAIT2  
tcp        1      0 localhost:smtp          localhost:37247         CLOSE_WAIT 
tcp        9      0 localhost:smtp          localhost:37245         CLOSE_WAIT 

I run Ubuntu 10.04 and Python 2.6.5

I don't know where to look next to figure out what's wrong. Please help me. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

背叛残局 2024-09-24 20:40:29

您的邮件服务器工作不正常。当您使用 telnet 连接到它时,您应该会看到一条欢迎消息,内容如下:(

220 your.server.name ESMTP Postfix

您可以通过运行 postconf smtpd_banner 检查您应该看到的问候语。)

您不明白这一点,因此邮件服务器未正常运行。 send_mail 可能正在等待初始消息。

重新启动Postfix,并查看/var/log/mail.*日志文件;那里可能有一个线索可以解释为什么它不起作用。

Your mail server isn't working fine. When you connect to it using telnet, you should see a welcome message along the lines of:

220 your.server.name ESMTP Postfix

(You can check the greeting that you should be seeing by running postconf smtpd_banner.)

You don't get that, so the mail server isn't running properly. send_mail is probably hanging waiting for that initial message.

Restart Postfix, and look in the /var/log/mail.* log files; there may be a clue in there as to why it's not working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文