Comparing efficiency in sending mail

Robin Thomas robin.thomas at
Sun Mar 25 19:58:53 CEST 2001

At 05:08 PM 3/25/01 +0000, Sheila King wrote:

>Anyhow, that last part is really off-topic here, as it is an issue with how to
>use sendmail/qmail. I just wanted to point out, that using the smtplib module
>is easier and gives me more control over the messages I send, and therefore
>I'm curious as to why I would want to use popen to send to sendmail instead.

If you use smtplib, your program is the MTA. Your program must do the 
actual message transfer by itself: checking/munging the message to be sent, 
blocking on connect to destination MTA, handling errors, retrying if 
desired, bouncing message to a mailbox, etc.

If you use sendmail, sendmail is the MTA. Your program, if it gives 
sendmail a minimally complete message, will complete the popen() function 
quickly, and sendmail will then worry about the actual sending of the 
message. Your program can do other things. As a "full-service" MTA, 
sendmail can retry sending, bounce the message to a mailbox, queue the 
message for sending later in a big batch, etc. Of course, "full-service" 
also means that sendmail does things to the message or with the message 
that you didn't ask it to do.

The choice you make is informed by your application's needs.

Robin Thomas
StarMedia Network, Inc.
robin.thomas at

More information about the Python-list mailing list