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="[email protected],[email protected]"; // and so on - over 100 addresses $reply="[email protected]"; $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") ; ?> Link to comment https://forums.phpfreaks.com/topic/48412-how-to-send-php-email-to-100-email-addresses/ Share on other sites More sharing options...
Lumio Posted April 24, 2007 Share Posted April 24, 2007 <?php $to="[email protected],[email protected]"; // and so on - over 100 addresses $reply="[email protected]"; $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") ; } ?> Link to comment https://forums.phpfreaks.com/topic/48412-how-to-send-php-email-to-100-email-addresses/#findComment-236737 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. Link to comment https://forums.phpfreaks.com/topic/48412-how-to-send-php-email-to-100-email-addresses/#findComment-236740 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 Link to comment https://forums.phpfreaks.com/topic/48412-how-to-send-php-email-to-100-email-addresses/#findComment-236829 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[]='[email protected]'; $to[]='[email protected]'; $reply="[email protected]"; $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 Link to comment https://forums.phpfreaks.com/topic/48412-how-to-send-php-email-to-100-email-addresses/#findComment-236834 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.