Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

sending newsletter emails

     
7:08 pm on Oct 28, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 21, 2002
posts: 1541
votes: 0


So I have a customer database, and if I want to email all of them is this the right way be to loop through all of my customers and use the mail() function?
8:33 pm on Oct 28, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 17, 2002
posts:2251
votes: 0


From: [php.net...]

It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.

For the sending of large amounts of email, see the PEAR::Mail, and PEAR::Mail_Queue packages.
2:30 am on Nov 1, 2012 (gmt 0)

Senior Member from MY 

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 1, 2003
posts:4847
votes: 0


GaryK is correct, assuming you are using SMTP delivery via a 3rd party host, in which case you might also use the smtp class from PHPMailer, which makes it much easier to manage this.

If you are using local mail delivery (your mail is sent by the same server that your code is on) things are typically much more efficient.

In my experience, you can push out <1k messages via SMTP mail() just fine on most servers. Over this it is worth looking at other forms of delivery. For mail which is locally handled, I'd say <5k, but do put a usleep or similar delay into the processing to keep server load down - I usually divide out the customers by the acceptable send time (e.g. 3k customers and I'm happy to wait three hours = 0.28s each mail, so insert about 0.2s sleep).