If you are developing a system that sends emails, depending on the network environment you are working on, the limit of Outbound Port 25 Blocking of your provider is 25 Sending emails via port number may be blocked.
You can send it via the SMTP server specified by the provider, but it is troublesome because you have to include the SMTP user information in the development mail sending settings.
At the time of development, I wanted to be able to check the contents of the email sent even if it was not actually sent, so when I was looking for an SMTP server for debugging, I found Python smptd.DebuggingServer. There was a standard library called 2 / library / smtpd.html # debuggingserver-objects).
You can start a dummy SMTP server with the following one-liner.
$ python -m smtpd -n -c DebuggingServer localhost:1025
Looking at the source of the
smtpd module, it only implements
SMTPServer # process_message, so I think it's a good idea to create a debug server adjusted as necessary.
class DebuggingServer(SMTPServer): # Do something with the gathered message def process_message(self, peer, mailfrom, rcpttos, data): ... print '---------- MESSAGE FOLLOWS ----------' for line in lines: ... print '------------ END MESSAGE ------------'
There was already a library called dsmtpd.