Reputation: 255
I'm using a simple php mailer script as related to another question i made on here awhile ago.
<?php
//print_r($_POST);
if(isset($_POST['_save'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
if (empty($name) || empty($email) || empty($subject) || empty($message)) {
if (empty($name))
$error['name'] = "Please enter your Full Name";
if (empty($email))
$error['email'] = "Please enter a valid Email Address";
if (empty($subject))
$error['subject'] = "Please Write a Subject";
if (empty($message))
$error['message'] = "lease write a message, inquiries or other concerns above";
}
else { //if not empty
$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
mail('[email protected]',$subject,$message,$headers); //mail the message;
$success = "Thank you! You're email has been sent.";
#done;
}
}
?>
how do i add 2 email addresses to send to? I would like to have the mailer to send to 2 separate email addresses
Upvotes: 0
Views: 335
Reputation: 9782
using this :
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';
mail($to,$subject,$message,$headers);
to know more about the mail()
function plz follow the link http://php.net/manual/en/function.mail.php
Upvotes: 2