popen(), sendmail: Success?

Thomas Bellman bellman at lysator.liu.se
Fri Apr 11 14:13:58 EDT 2003


mb at muenster.de (Martin Bless) wrote:

> 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?

Define "operation succeeded"...  Do you want to know if /usr/lib/sendmail
managed to queue the message for delivery?  Or do you want to know
if the mail reached its destination?  Or do you want to know if the
recipient has read the mail?

It is quite difficult to know if the mail reaches its destination.
You have to wait for several days and check for email bounces, i.e,
your program must be capable of *reading* mail too, not just
sending, and it must be able to differentiate between real bounces,
warnings that the mail hasn't been delivered for X hours (some mail
systems send a warning if it hasn't been able to pass the mail on
to the next hop within a few hours), and any other mail that might
arrive (like spam...).

Knowing whether the recipient has actually *read* the mail is even
more difficult...

However, if you just want to know that the mail has been placed in
the queue of the systems MTA, then it is much easier.  And others
have already answered that part.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"Life IS pain, highness.  Anyone who tells   !  bellman @ lysator.liu.se
 differently is selling something."          !  Make Love -- Nicht Wahr!




More information about the Python-list mailing list