I just wrote a set of classes for mass mailing to process a huge number of letters and analyze their contents in accordance with the parameters passed. If I test email for 1000 random recipients and 1000 random senders from my database, until the point of the script hits the send () part (I commented on it for now), I get a performance of about 2 seconds and 20 MB of peak memory which is great.
However, if I uncomment the portion of the submission, the submission will take 30 seconds. This is unacceptable, and I would like to somehow speed it up. From the test it is clear that the delay is caused by nothing more than a call to $ mail-> send (), as if he expected him to return something before continuing the cycle and sending the next letter.
I am wondering: how to speed up the send () call? What can I do to make it faster? I tried using two sending methods:
- Zend SMTP transit, connecting to the server directly and sending. It takes 30 seconds per 1000 letters.
- Sendmail through Zend_Mail. By simply calling the send function Zend_Mail after preparing each letter. It takes 60 seconds.
Note that queue is definitely an option, and I have built it into my classes. All that is required is to activate cron, and it works like a charm. But I am interested to know about the actual dispatch and how to speed it up. So, the actual call to send ().
source share