DustinK44 Posted September 4, 2008 Share Posted September 4, 2008 Hello. I am getting the error PHP Warning: mail(): Mail header contains implicit recipients. Mail not sent. in /path/to/script.php on line 12 when executing the following code: <?php $email = '[email protected]'; $headers = 'From: Support Support <[email protected]>'."\r\n". 'Reply-To: Support Support <[email protected]>'."\r\n". 'Content-type: text/html; charset=iso-8859-1'."\r\n". 'Bcc: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $to = '$email; $subject = 'Product Serial Number'; $message = 'Hallo'; if(!mail($to, $subject, $message, $headers)) { echo 'Failed to send mail, please try again'; } else { echo 'OK'; } ?> Anyone out there know why this is happening? PHP 5.2.6 with Suhosin-Patch 0.9.6.2 Thanks! DustinK Link to comment https://forums.phpfreaks.com/topic/122775-php-warning-mail-mail-header-contains-implicit-recipients/ Share on other sites More sharing options...
Mchl Posted September 4, 2008 Share Posted September 4, 2008 You've got an extra ' here: $to = '$email; That's first thing I can notice. Also, perhaps the patch you;ve got installed has this patch in it http://www.lancs.ac.uk/~steveb/patches/php-mail-reject-implicit-recipients-patch/ It will not allow Bcc: field in headers. Link to comment https://forums.phpfreaks.com/topic/122775-php-warning-mail-mail-header-contains-implicit-recipients/#findComment-633973 Share on other sites More sharing options...
DustinK44 Posted September 4, 2008 Author Share Posted September 4, 2008 Thanks! -Forgot to add "'" in the code snippet. (It was there originally) Also, perhaps the patch you;ve got installed has this patch in it http://www.lancs.ac.uk/~steveb/patches/php-mail-reject-implicit-recipients-patch/ It will not allow Bcc: field in headers. helps a lot! Link to comment https://forums.phpfreaks.com/topic/122775-php-warning-mail-mail-header-contains-implicit-recipients/#findComment-633978 Share on other sites More sharing options...
Mchl Posted September 4, 2008 Share Posted September 4, 2008 Thanks! -Forgot to add "'" in the code snippet. (It was there originally) Actually it's not needed at all. Just use: $to = $email; You can also change a way your headers are defined $headers = "From: Support Support <[email protected]>\r\n Reply-To: Support Support <[email protected]>\r\n Content-type: text/html; charset=iso-8859-1\r\n Bcc: [email protected]\r\n X-Mailer: PHP/". phpversion(); Less quotes to care about Link to comment https://forums.phpfreaks.com/topic/122775-php-warning-mail-mail-header-contains-implicit-recipients/#findComment-633982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.