Python, Unix sendmail, and multiple recipients
Matthew Dixon Cowles
matt at mondoinfo.com
Tue Oct 16 13:38:38 EDT 2001
More information about the Python-list mailing list
Tue Oct 16 13:38:38 EDT 2001
- Previous message (by thread): Python, Unix sendmail, and multiple recipients
- Next message (by thread): Python, Unix sendmail, and multiple recipients
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 16 Oct 2001 10:58:49 -0500, Kemp Randy-W18971 <Randy.L.Kemp at motorola.com> wrote: >Can anyone give me an example of how to invoke the Unix sendmail in >Python, and send an email message to more then one recipient (two >people, for example)? Dear Randy, If it's practical, I'd use Python's smtplib. It's documented at: http://www.python.org/doc/current/lib/module-smtplib.html Since it uses a socket connection, it doesn't require that the MTA be sendmail and the MTA doesn't have to be on the local machine. If you really want to use a local copy of sendmail, you could open a pipe to it and invoke it with the -t option so that it will read the recipients from the message. Something like (untested): p=os.popen("/usr/lib/sendmail -t","w") p.write(msg) p.close() Your sendmail may well not be in /usr/lib. If you need to specify the recipients outside of the message text, they can be put on the command line (again untested): p=os.popen("/usr/lib/sendmail a at example.org b at example.org","w") p.write(msg) p.close() Regards, Matt
- Previous message (by thread): Python, Unix sendmail, and multiple recipients
- Next message (by thread): Python, Unix sendmail, and multiple recipients
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list