I want to add bcc in my mail function php file.
if(isset($_POST['fname']) && isset($_POST['lname']) && isset($_POST['email']) && isset($_POST['phone']) && isset($_POST['message'])){
if(!empty($_POST['fname']) && !empty($_POST['lname']) && !empty($_POST['email']) && !empty($_POST['phone']) && !empty($_POST['message'])){
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = $_POST['message'];
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo'Please feel valid email';
}
else {
$to='kriti@vsbhotels.com, contact@vsbhotels.com, verun@vsbhotels.com';
$body = $fname."\n". $lname."\n" . $phone."\n" . $email."\n" . $message;
if(mail($to , $fname." ".$lname , $body ,'From: response@themerakihotel.com')) {
header('Location: thank-you.html');
exit();
}
else {
echo "Something went wrong!";
}
}
}
else {
echo 'Please Fill All Inputs';
}
}
else {
echo 'not okk';
}
echo "<meta http-equiv='refresh' content='0; url=http://merakihotels.in/demo/'>";
add in header:
$headers[] = 'Bcc: someone@example.com';
for your code:
mail($to , $fname." ".$lname , $body ,'From: response@themerakihotel.com' . "\r\n" . 'Bcc: someone@example.com')
Though not solved then try:
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: FromName<from@example.com>' . "\r\n";
$headers .= 'BCC: Someone<someone@example.com>' . "\r\n";
mail($to, $subject, $message, $headers);
Just add BCC:with your email id
in headers
parameter.
$headers="From: response@themerakihotel.com\r\n";
$headers.="BCC:WRITE HERE YOUR EMAIL ID";
mail($to , $fname." ".$lname , $body ,$headers);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.