Using pythons smtp server
rosuav at gmail.com
Fri Dec 13 19:15:55 CET 2013
On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis <vincent at vincentdavis.net> wrote:
> Let me rephrase my question. I want to send an email using python but do not
> want to use an external service. Does python have the ability to send emails
> without installing additional software or using an external server/service?
Any SMTP server you install has to do one of three things with the
mail you give it:
1) Accept it locally. Presumably the wrong thing to do here.
2) Deliver it to the authoritative SMTP server for the domain.
3) Deliver it to an intermediate server.
(Edit: Your next mail shows that you understand that, as looking up
the MX record is what I was going to say here.)
So if you want to avoid using an external intermediate server, you
need to find and talk to the authoritative server. Now, this is where
another big consideration comes in. What envelope From address are you
going to use? Is your own IP address allowed to send mail for that
domain? If not, you may be forced to use the legitimate server for
that domain. There are other concerns, too; if you don't have a nice
name to announce in the HELO, you might find your mail treated as
spam. But if you deal with all that, then yes, the only thing you need
to do is look up the MX record and pick the best server. (And then
deal with other concerns like coping with that one being down, which
is the advantage of having a local mail queue. But sometimes that
doesn't matter, like if you're sending to yourself for notifications.)
More information about the Python-list