SMTPlib question

Tim Roberts timr at probo.com
Sat Aug 26 01:41:42 EDT 2000


dgreco at atlantic.net wrote:

>Not sure if this is really a Python question or a sendmail question.

It's a sendmail question, but it's a tricky situation.

>I have written a CGI that takes thousands of email addresses in from a
>form and sends emails to them using SMTPlib. Running it from the
>command-line, it takes about 5 minutes per 1,000 addresses. Needless to
>say, as a CGI, this won't work because the HTTP connection timeouts.
>The script works fine for small numbers of addresses.
>
>I imagine it takes so long because the SMTP server (sendmail) it
>connects to verifies various info on the email such as the domain for
>it. Is this why it is taking so long?

If you were actually invoking the sendmail command line, there is a command
line switch you can add which tells it to send everything to its queue to
be processed in the next go-round, instead of processing it immediately.

Probably your best choice is to fork off a new process and call sendmail
from it.  Then your main process can close stdin, which closes the HTTP
connection.  I've done this in an almost identical situation (although it
was in perl...).
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list