Jump to content

php mail Bcc not working


conan318

Recommended Posts

email not working at all

 

<?php
$e=$_POST['email'];
$e1=$_POST['email1'];
$e2=$_POST['email2'];
$e3=$_POST['email3'];
$e4=$_POST['email4'];
$e5=$_POST['email5'];
$e6=$_POST['email6'];
$e7=$_POST['email7'];
$e8=$_POST['email8'];
$e9=$_POST['email9'];

$cc=$e1.",".$e2.",".$e3.",".$e4.",".$e5.",".$e6.",".$e7.",".$e28.",".$e39.",";
$to      = $e;  
$subject = 'You have Been Invited ';  
$message = ' 

test message
--------------------------------------------------------------------------------------

';
$headers = 'From:'.$email . "\r\n"; 
$headers .= 'Bcc:'. $cc . "\r\n";
  
mail($to, $subject, $message, $headers);
?>

Link to comment
https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/
Share on other sites

are you sure that all of those email forms were filled out? You don't check if all of them are sent, and if some aren't, that will result in a BCC string like

[email protected],[email protected],,,[email protected]....

 

which would result in a malformed header and may cause your email to fail

mail() does not care if the email address doesnt actually exist, as long as it is valid (by valid i mean correctly formed).

As long as an email address is accepted for delivery it shouldnt cause an issue.

To ensure your script has the best chance of success, you will need to remove all empty elements as mikesta707 said and test the emails to the best of your ability for validity.

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.