Mass Mailing help needed (Paul Rubin)

Graham Ashton gashton at cmedltd.com
Tue Apr 23 05:18:41 EDT 2002


On Mon, 2002-04-22 at 20:20, Jeff Shannon wrote:

> I would avoid directly invoking sendmail at all.  My mailer uses 
> smtplib to contact the mail server, and this *seems* fairly 
> efficient.

With that approach you have to open one TCP connection per message. This
is expensive, especially as your SMTP daemon should be doing all sorts
of checks on your IP to see if it'll happily accept mail from you. Not
only that, if you want to send a lot of messages you'll soon run out of
TCP ports on most unix boxes, which can have nasty side effects.

Calling sendmail directly is like giving it an intravenous injection.
Sending messages in via TCP port 25 is like giving it a couple of pills
and a sip of water.

> Since smtplib functions at a level of individual messages ....

You'll run out of connections in no time. I've never had to send more
than 10,000 messages in a customer mailing, but I always spread them out
over quite a long period of time (i.e. four hours or so) in order to
reduce the negative effect on our servers. Optimising it too much was
never really a priority, though I'm sure it would have been possible.

-- 
Graham Ashton






More information about the Python-list mailing list