I have this PHP code for sending emails from a website's contact form:
<?php
if(count($_POST) > 0){
$userName = $_POST['userName'];
$userEmail = $_POST['userEmail'];
$userSubject = $_POST['userSubject'];
$userMessage = $_POST['userMessage'];
$header = "Content-Type: text/html\r\nReply-To: $userEmail\r\nFrom: $userEmail <$userEmail>";
$body =
@"Contact sent from website ".$_SERVER['REMOTE_ADDR']." | Day and time ".date("d/m/Y H:i",time())."<br />
<hr />
<p><b>Name:</b></p>
$userName
<p>———————————</p>
<p><b>Subject:</b></p>
$userSubject
<p>———————————</p>
<p><b>Mensagem:</b></p>
$userMessage
<hr />
End of message";
if(mail("email_recipient_1@mailserver.com", "Mensage sent from website", $body, $header)){
die("true");
} else {
die("Error sending.");
}
}
?>
I need to change it in order to send emails to two recipients:
- "email_recipient_1@mailserver.com"
- "email_recipient_2@mailserver.com"
... don't know how, though. Where do I put the other e-mail? I tried adding "email_recipient_2@mailserver.com" in the mail() but it didn't work...
Thanx.
Pedro