Not a Member Yet,
Click here to Register

ID: 2
Viewed: 4084
Added: Nov 14, 2001
Version:
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

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.

<!---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 Comments to show

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


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!