Hi, I have this php email code that works fine but I want to add a second recipient to emails. I tried adding it here but it didnt work
"CONTACT_FO RM", 'contact@mysite .co.uk' , 'secondemail@ho tmail.com'
Any ideas would be great.
Thanks in advance
Richard
"CONTACT_FO RM", 'contact@mysite .co.uk' , 'secondemail@ho tmail.com'
Code:
<?php
// Where will you get the forms' results?
define("CONTACT_FORM", 'contact@mysite.co.uk');
?>
Code:
<?php
include dirname(dirname(__FILE__)).'/mail.php';
error_reporting (E_ALL ^ E_NOTICE);
$post = (!empty($_POST)) ? true : false;
if($post)
{
include 'email_validation.php';
$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
$error = '';
// Check name
if(!$name)
{
$error .= 'Please enter your name.<br />';
}
// Check email
if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}
if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}
// Check message (length)
if(!$message || strlen($message) < 10)
{
$error .= "Please enter your message. It should have at least 10 characters.<br />";
}
if(!$error)
{
$mail = mail(CONTACT_FORM, $subject, $message,
"From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"
."X-Mailer: PHP/" . phpversion());
if($mail)
{
echo 'OK';
}
}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}
}
?>
Thanks in advance
Richard
Comment