I want to send mail to hundreds of email addresses in PHP using php mail function. How can I do that?
Use PHPMailer library, it has a lot of functionality. Store the email addresses as an array and using for loop just keep adding each email address as a string to the mail->AddAddress field. It will take care of sending the bulk mail. I have only used this to send bulk mails to 6/7 addresses at a time. It should also work for hundreds of addresses.
You can also use SwiftMailer
Please also look at a similar post here
You must use PHP? If so, I'd use PHPMailer, I have a bit of experience with it and it hasn't failed me for bulk email sending.
Alternatively, if you have access to the server, look at using Postfix or Sendmail, they are better options for that quantity of mail.
If you're sending a lot of mail, you don't want to do it all @ once or else you will consume too many resources.
Here is a Tutorial on how to use the Mail_Queue component of the PEAR library: http://pear.php.net/manual/en/package.mail.mail-queue.mail-queue.tutorial.php
It basically will incrementally send segments of your email blast without throttling your server.
I wouldn't try writing your own bulk mailer, unless you have a lot of time. There is allot of issues to cover including throttling emails, sending emails out into small batches so AOL and other service providers don't consider your server as SPAMMING people. Also you want to probably include tracking for opened emails, track bounced emails, clicked links, etc.
I would look at some open source options such as www.phplist.com which is a very good open source program for doing bulk emails.
Or on the commercial side take a look at Interspire Email Markerer, it's a very slick product and well worth the money, plus you can host it on your own servers.
www.interspire.com/emailmarketer/