mysty Posted December 7, 2006 Share Posted December 7, 2006 <?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 More sharing options...
doni49 Posted December 8, 2006 Share Posted December 8, 2006 $bcc = "[email protected]";$headers = 'bcc: ' . $bcc ."\n"; Link to comment https://forums.phpfreaks.com/topic/29856-mail-trouble-with-bcc/#findComment-137193 Share on other sites More sharing options...
mysty Posted December 8, 2006 Author Share Posted December 8, 2006 <?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 More sharing options...
doni49 Posted December 8, 2006 Share Posted December 8, 2006 The bcc line overwrites the headers. Sorry I didn't notice that.$headers [b][color=red].[/color][/b]= 'bcc: ' . $bcc ."\n"; Link to comment https://forums.phpfreaks.com/topic/29856-mail-trouble-with-bcc/#findComment-137239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.