About the python smtpd library, I try to override the process_message method, but when I try to connect to it with client and send message to, say a gmail account, it just print the message out on console, but I want it actually to send out the message like postfix in local machine. How should I achieve this?
I google smtpd, but not much useful message to find
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()