phpQuestioner Posted April 24, 2007 Share Posted April 24, 2007 I have a script that send out html email and I have over 100 email address from people who would like to join my newsletter. But I cannot get my script to email all 100+ of these people. Any one know how I can do this? Here Is My Script <?php $to="customer1@yahoo.com,customer2@gmail.com"; // and so on - over 100 addresses $reply="noreply@companyname.com"; $from="Company Name Here"; $subject="Newsletter"; $message="<!--html content here-->"; @mail($to ,$subject ,$message ,"From: $from\nReply-to: $reply\nContent-Type: text/html; charset=iso-8859-1") ; ?> Quote Link to comment Share on other sites More sharing options...
Lumio Posted April 24, 2007 Share Posted April 24, 2007 <?php $to="customer1@yahoo.com,customer2@gmail.com"; // and so on - over 100 addresses $reply="noreply@companyname.com"; $from="Company Name Here"; $subject="Newsletter"; $message="<!--html content here-->"; $to = explode(',', $to); foreach($to as $s) { @mail($s ,$subject ,$message ,"From: $from\nReply-to: $reply\nContent-Type: text/html; charset=iso-8859-1") ; } ?> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted April 24, 2007 Author Share Posted April 24, 2007 Lumio, I tried your script, but could not seem to get it to work. Quote Link to comment Share on other sites More sharing options...
calabiyau Posted April 24, 2007 Share Posted April 24, 2007 If your emails are stored in a database you could try just setting up a for loop and sending out an individual email to each row in the database Quote Link to comment Share on other sites More sharing options...
taith Posted April 24, 2007 Share Posted April 24, 2007 basically... you got 2 options... 1) send out one email with many To:'s... makes some email servers mad... 2) send out many emails with 1 To:'s... works a little slower on the user's end... <?php $to[]='customer1@yahoo.com'; $to[]='customer2@gmail.com'; $reply="noreply@companyname.com"; $from="Company Name Here"; $subject="Newsletter"; $message="<!--html content here-->"; $to=implode(",",$to); mail($to, $subject, $message, $headers); ?> or foreach($to as $t){ mail($t, $subject, $message, $headers); } both of which should work... considering your headers are set properly... you might also wanna check with your host, see if theres a limit on how many people you can send an email to at once... if its too low... choose option 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.