Stupid PHP mail function and mass mailing

We´ve just done a mailing out to 13,000 receipients using a custom php script I wrote that goes and gets a bunch of email addresses from the database and then loops through them and calls the php mail() function. It all seemed to be working well until we started getting feedback from some of the people on the list saying that they were getting up to 11 copies of the email.

 
This seemed very strange since I´ve used this script many times without any problems so I decided to get down to the root of the problem. Luckily I had put in some error checking so I went to the database to see what was going on. Long story short, the php bit was only being run once for each email address, including the mail function. For some reason though, sendmail was pushing out more than one copy of the message.
 
I decided to hit google and see what I could find out there before I started messing around with scripts and testing different server configurations. After a bit of searching I found out that nobody really knows what might be causing it. Some reckon it´s sendmail pushing up the server load, some reckon it´s php´s mail function not receiving "true" variables from sendmail.
 
Either way, since there´s no definate answer I´m going to start running some tests and see what I can come up with myself.

About the Author

I'm a web developer based in the East Midlands, UK and if I keep up the current rate, I might have developed 3 million sites by the time I retire