views:

74

answers:

2

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?

+1  A: 

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.

FractalizeR
Thank you. I need to build a newsletter management so I need script which is more faster i will try swiftmailer.
RSK
Ok ;) Don't forget one of the replies after you will solve your case.
FractalizeR
I used swiftmailer in my website, i able to sent more than 500 quickly. It solved my problem and also it has many option. Thank you for all.
RSK
Welcome. Please don't forget to mark one of the answers as the one, which solved your problem to accept answer.
FractalizeR
+1  A: 

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.

rikh
Thank you rikh. I tried to sent mail through BCC, but same result.
RSK
BCCing is not always desired as ALL email addresses will still present in EVERY message. So, if someone will like to spam ALL your customers, he will easily do that.
FractalizeR
Hmm, I don't think so. If you CC everyone, then sure, they will all be able to see the list, but BCC (Blind Carbon Copy) should not include information on anyone else in the BCC list.
rikh