Question

I am using php sendmail() function in my projects. When I sent above 3 or more mails processing gets too slow. What is the problem? If I use PHPMailer, will this problem solve?

Was it helpful?

Solution

There are a few things that can be causing this to be slow.

You may be waiting for each email to be fully sent before sendmail() returns. This will mean opening a SMTP socket, talking to another mail server, sending the email and closing up the socket again.

We have a system that sends quite a few emails out in batches and we use PHPMailer for that. We open the socket once, send lots of messages then close it up again, and we get good performance on this (it can send several hundred emails in a single run).

If your message is identical to all recpients, I would recommend sending them all in a single email and BCC'ing everyone, as this takes a lot of pressure away from your script.

Another thing to check is local virus scanners. We used to have problems with the outgoing email scanner grinding the whole thing to a halt. Worth looking into.

OTHER TIPS

Seems, your mail() functions has some restrictions applied to sendmail or some problems. Try sending mail via SMTP for example using this :http://swiftmailer.org/ and see if it will solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top