Could you please suggest a simple SMTP server with the very basic APIs (by very basic I mean, to read, write, delete email), that could be run on a linux box? I just need to convert the crux of the email into XML format and FTP it to another machine.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you want to quickly test Django's send_mail with hasen's answer above:
Not necessary to have valid values in send_mail function. Above values will work just fine with hasen's example.
Take a look at this SMTP sink server:
It uses
smtpd.SMTPServer
to dump emails to files.To get Hasen's script working in Python 3 I had to tweak it slightly:
There are really 2 things required to send an email:
For reading, there are two options depending on what server you are reading the email from.
A more modern approach is to use the aiosmtpd library (documentation available here).
You can find a good example here: https://aiosmtpd.readthedocs.io/en/latest/aiosmtpd/docs/controller.html.
These are nice examples for a start.
smtpd – Sample SMTP Servers
http://pymotw.com/2/smtpd/index.html
smtplib – Simple Mail Transfer Protocol client
http://pymotw.com/2/smtplib/index.html