The send_immediately or send_message method in pyramid_mailer are blocking
thread, when using in a batch sending program, for example, send email to
members in a group could be a bad idea. The code executed after email
sending part has to wait for it to be finished. In a worst scenario when
the network becomes slow or remote smtp server is down then the whole batch
program will be hanging there waiting for the emails to be send. So I have
been spending hours of time to figure out how to implement send_to_queue
feature of pyramid_mailer. I setup a local postfix smtp server and
configure a relay smtp server of my ISP. Then I use the "qp
/path/to/maildir" to pickup the emails there and send out the email. Doing
this way I just "let go" the email sending portion my code in the batch,
delegate the sending task to the external qp program. So I arrange the
running of the qp at the end of the batch as the last task. I'm wondering
if this is the best way of implementing "send_to_queue", I'm not a system
administrator who familiar with the mail system, I'm expecting somebody can
give me suggestion on this topic.

Repoze-dev mailing list

Reply via email to