SMTPlib question

dgreco at atlantic.net dgreco at atlantic.net
Mon Aug 28 18:57:46 EDT 2000


Yeah it proved to be pretty tricky. I found the flags that tell
sendmail to just queue the message, but it was still way too slow. I
tried starting a new thread that would send the emails, and then
flushed and closed STDOUT, but the new thread got killed once STDOUT
got closed.

I finally decided to give mod_python a try. I started a new thread to
send the emails, and it continues running even after I have
returned "apache.OK" to the client. It works great!

~Dave Greco


In article <1sleqs04vogchgk3gte03k9gcoptbj2evb at 4ax.com>,
  Tim Roberts <timr at probo.com> wrote:
> 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.
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list