python SMTP server

Benjamin Niemann pink at odahoda.de
Sun Jul 31 07:14:42 EDT 2005


Fernando M. wrote:

> Hi,
> i made a test with smtplib module a few days ago, for sending mails,
> and i was wondering if there's another module for running an SMTP
> server, so i could make a standalone script for sending mails without
> using an external SMTP server.
> I've been searching but i'm not sure if there are modules for it, or
> anything.
> Which ones are my options?

An SMTP server is (simplified) a program that listens on port 25 for
incoming mails.

What you probably want to do is:
Do a DNS query for the recipent's domain and use smtplib to connect to the
server specified in the MX record. There was a module for DNS querie (not
in Python's stdlib), but I forgot how it was called or where you could find
it (try the Vaults of Parnassus or PyPI).

Or you may use an external tool like 'dig' ('dig mx DOMAIN').

But you should be aware of the fact that (if you send mail from a dialup
machine without going through a relay server) your mails will quickly be
marked as spam - I hope you do not intend to send spam...

-- 

Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/



More information about the Python-list mailing list