Paulo Scardine
Paulo Scardine

Reputation: 77271

Python smtplib slower than PHP mail()

I ported some PHP applications to Python.

To my surprise, performance dropped by ten times in the newsletter module (100k+ subscribers). I was expecting some overhead for using SMTP (I think PHP calls sendmail directly), but not that much.

How can I speedup Pythons mail delivery?

EDITED: For anyone digging this question, I solved this using celery with 8 workers to delivery e-mail in background, with this setup I can deliver about 200K messages per hour. Celery integrates very well wit django, and AMQP rocks.

Upvotes: 1

Views: 629

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798686

PHP's mail() does indeed use sendmail. You can do the same thing in Python by invoking it via subprocess.

Upvotes: 3

Related Questions