Hello Everyone,
I’ve already put together a script (basically using the mail function in PHP) to send out emails. That was step one of this project. I need help with the next two steps:
First, I want to have a list of email addresses that it would send the messages to. I’m guessing this would require a list of email addresses, and a loop function?
Second, I have four different emails - where the content is slightly different. I want to send out any one of those four emails randomly the users.
I’m still very early in my learning phase of PHP but this is a project at this time and would greatly appreciate any help that you can provide. My simple code to actually send the email is below:
[php]<?php
set_time_limit (300);
$Name = $_POST[‘name’]; //senders name
$email = $_POST[‘email’]; //senders e-mail adress
$recipient = $_POST[‘recipient’]; //recipient’s email address
$mail_body = $_POST[‘mail_body’]; //mail body
$subject = $_POST[‘subject’]; //email subject
$header = "From: “. $Name . " <” . $email . “>\r\n”; //optional headerfields
// $emailList
// foreach ($emailList as $thisEmail) {
// mail($thisEmail);
//}
mail($recipient, $subject, $mail_body, $header); //mail command
echo "Email sent to $recipient on behalf of $Name
";
?>
[/php]