snippet library logo
in category
PHP / Email / Looping thru a mailing list
Snippet details
ID: 2
Viewed: 1786
Added: 2001-11-14
Version:
Sorry no demo

User Rated at:
Rate This:
Snippets in this catagory         
Show Printable Version
this loops thru a email list that is stored in an array and send to everybody in that array. Can also set a time limit so the script doesn't time out.

General Details
Snippet uploaded by: snippet
Email : webmaster@snippetlibrary.com
Snippet By: snippet

<!---Head--->
none

<!---Body--->


<?
// set up a message
$subject "Your subject.";
$msg "I'm looping mail!";
$headers "From: me@mycompany.comnReply-To: someoneelse@mycompany.com";
// this is your array of addresses
$addresses = array("me@mycompany.com""you@yourcompany.com""someone@otherplace.com");
// remember, array indices start at 0
For($i 0$i count($addresses); $i++) {
  
// get the recipient address
  
$To $addresses[$i];
  
//send the mail
  
mail("$to""$subject""$msg""$headers");
  
//print a confirmation to the screen
  
echo "mail sent to $to <br>";
}
?>

//To set a time limit within a script, you use the set_time_limit() //function. You can specify the limit, such as 60 seconds 
set_time_limit(60) 
//, or you can allow it to run until it's absolutely done
set_time_limit(0) 




No Reviews to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Subject:

Reviewed By:

Write a review:





Terms of Conditions
Powered By
Avian Hosting
© 2005 snippetlibrary.com All Rights Reserved.