Page 1 of 1

Is it reasonable to use the mail function to send 3000 mails

Posted: Fri Sep 16, 2005 12:17 am
by spartan7
Hi all

Is it reasonable to use the mail function to send 3000 mails at a time?

If I have 3000+ contacts in my database and I need to send email emails, what is the best way of doing it? I havnt used the mail function to send to so many people before and I'm wondering if its reasonable to do so.

Thanks

Posted: Fri Sep 16, 2005 1:48 am
by Buddha443556
Not if you can avoid it? PHP mail function isn't the most efficient way to send mail.

Shared host? Well if your on a shared host, they'll either not want you to be sending that many emails or want you to break them up. Send 5, wait a minute, send 5 more sort of thing. You do search here you might find some code.

3000 is a lot. You should ask your host.

Posted: Fri Sep 16, 2005 5:51 am
by onion2k
The problem with the mail() function is that it opens a connection to the mail server, sends, then closes it again. If you're sending a lot that's a horrible way of doing things. It's much better to open a connection, send all the emails, and then close it. The old version of my email marketing app did that and regularly sent batches of 10,000 HTML emails .. I think the record is around 15,000.

However, even that got to be a bit intensive on the server, and took ages to run, so I rewrote it in Perl. 160,000 emails .. no problem. And it's pretty quick too .. it averages around 10/second with full customisation. I'm sure I could get it going faster though, there's still some old unoptimized code in there. Just don't have the time these days.

Posted: Fri Sep 16, 2005 8:17 am
by dbevfat
onion2k wrote:The problem with the mail() function is that it opens a connection to the mail server, sends, then closes it again. ...
Actually it's not always like this. On majority of linux servers the mail() function just queues the mail locally and returns true if the queueing was successfull. The actual sending from the queue is done by another process.

Posted: Sat Sep 17, 2005 4:03 am
by Chris Corbyn
dbevfat wrote:
onion2k wrote:The problem with the mail() function is that it opens a connection to the mail server, sends, then closes it again. ...
Actually it's not always like this. On majority of linux servers the mail() function just queues the mail locally and returns true if the queueing was successfull. The actual sending from the queue is done by another process.
I didn't realise that myself :) I know that on *nix servers the "path_to_sendmail" is used so it does make sense.