Using pythons smtp server

Grant Edwards invalid at invalid.invalid
Fri Dec 13 19:12:07 CET 2013

On 2013-12-13, Vincent Davis <vincent at> wrote:

> Obviously I don't really know how this works. I have used python to
> send email using "my" smtp server (whatever that may be gmail,
> postfix..) But I don't want to do that. After a little more research
> I think what I need to do is lookup the MX address of the address I
> want to send the email too.
> Then submit the email to that address using smtplib.SMTP

Maybe.  In theory, that will work -- and it did in the good old days
before SPAM (the electric kind) was invented.

But, many SMTP servers (the ones pointed to by the MX record) will not
accept mail from you unless you meet various requirements (which vary
considerably and the SMTP servers administrators try to keep secret).

For example you may have to be sending from an IP address who's
reverse-DNS lookup matches up with the from headers and with the MX
record for the domain you claim to be sending from.

Your mail might also get blocked/discarded if you're sending from
what's been identified as a dynamically allocated IP block (even if it
does have proper DNS and MX records).

Grant Edwards               grant.b.edwards        Yow! Look into my eyes and
                                  at               try to forget that you have
                                a Macy's charge card!

More information about the Python-list mailing list