【发布时间】:2016-10-25 03:09:16
【问题描述】:
我尝试运行一个简单的 python SMTP 服务器,但由于某种原因,当我将它发送到服务器时它不会收到任何传入的电子邮件。我正在使用来自https://pymotw.com/2/smtpd/index.html 的以下代码:
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
return
server = CustomSMTPServer(('127.0.0.1', 25), None)
asyncore.loop()
我正在运行脚本:sudo python simpleSmtpServer.py
一些注意事项:
- 我正在 AWS EC-2 实例上运行此脚本
- 我知道我正确设置了我的 MX 记录;我尝试使用带有 nodejs 的 Mailin (https://github.com/Flolagale/mailin) 运行一个简单的 smtp 服务器,它能够接收和显示我发送的测试电子邮件
此代码是否缺少任何我需要更新的 DNS 配置?
【问题讨论】:
-
127.0.0.1仅接收本地连接(来自同一台计算机)。使用0.0.0.0接收来自系统中所有“网卡”的连接。 -
这是正确答案