sendmail library ?!

Cameron Simpson cs at zip.com.au
Wed Nov 13 02:17:46 EST 2013


On 13Nov2013 05:52, Tamer Higazi <th982a at googlemail.com> wrote:
> I am looking for a python library that does mailing directly through
> "sendmail".
> When I look into the docs, I see only an "smtlip" library but nothing
> that could serve with sendmail or postfix.

Use the subprocess module. Pipe to:

  /usr/sbin/sendmail -oi addr1 addr2 ...

If the exit code is 0, mail dispatched.

This is a trivial function; you don't need a library for this.

Both "sendmail" and "postfix" (and "qmail" et al) provide a "sendmail"
executable for exactly this purpose.

The smtplib is for making arbitrary SMTP operations, thus a whole
module.  Sendmail does all that for you, you only need to deliver
the message to it and ensure it was accepted.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

The mere existence of a problem is no proof of the existence of a solution.
        - Yiddish Proverb



More information about the Python-list mailing list