关于 python smtpd 库,我尝试覆盖 process_message 方法,但是当我尝试与客户端连接并将消息发送到 gmail 帐户时,它只是在控制台上打印消息,但我希望它实际发送在本地机器中输出类似后缀的消息。我应该如何实现这一目标?
我谷歌 smtpd,但找不到太多有用的消息
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
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', 1025), None)
asyncore.loop()