popen(), sendmail: Success?

Martin Bless mb at muenster.de
Thu Apr 10 16:57:17 EDT 2003


To send mails from Python here's the example my provider provides:
This http://faq.puretec.de/skripte/python/3.html

The relevant lines are these:

sendmail = os.popen("/usr/lib/sendmail -t", "w")
sendmail.write(msg)
sendmail.close()

This works just fine. But is it enough? How do I know the operation
succeeded?

I've read the docs about os.popen[234] and the module popen2 but I'm
not sure where to go. And since experimentation isn't easy in this
case I'd appreciate some hints or a concrete example very much.

Do I have to use popen2.popen3() and its wait() method? I have to
admit that I don't understand too much of what's being said about this
in the docs ... :-(

Martin






More information about the Python-list mailing list