Jump to content

mail() trouble with bcc:


mysty

Recommended Posts

<?php
$to = "[email protected]";
$subject = "Subject goes here";
$message = 'Name: '.$_POST['name']."\n\n";
$message.= 'Phone: '.$_POST['phone']."\n\n";
$message.= 'Email: '.$_POST['email']."\n\n";
$message.= 'Comments: '.$_POST['comments']."\n\n";
$headers = 'From: '.$_POST['email']."\n";
mail($to,$subject,$message,$headers);
?>

this code works well, but I tried several things to get bcc to work, without success.
What do I need to add?  BTW- the bcc email address is to be hard coded in.
Link to comment
https://forums.phpfreaks.com/topic/29856-mail-trouble-with-bcc/
Share on other sites

<?php
$to = "[email protected]";
$subject = "Subject goes here";
$message = 'Name: '.$_POST['name']."\n\n";
$message.= 'Phone: '.$_POST['phone']."\n\n";
$message.= 'Email: '.$_POST['email']."\n\n";
$message.= 'Comments: '.$_POST['comments']."\n\n";
$headers = 'From: '.$_POST['email']."\n";
$bcc = "[email protected]";
$headers = 'bcc: ' . $bcc ."\n";

mail($to,$subject,$message,$headers);
?>

Now the code looks like this.  The script sends the emails to both inboxes, however,
the 'From: ' no longer works.
Link to comment
https://forums.phpfreaks.com/topic/29856-mail-trouble-with-bcc/#findComment-137233
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.