Jump to content

How To Send PHP Email To 100+ Email Addresses


phpQuestioner

Recommended Posts

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") ;

?>

<?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") ;

}

 

?>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.