conan318 Posted October 7, 2011 Share Posted October 7, 2011 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/ Share on other sites More sharing options...
mikesta707 Posted October 7, 2011 Share Posted October 7, 2011 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 my@email.com,other@email.com,,,ISkippedLines@email.com.... which would result in a malformed header and may cause your email to fail Quote Link to comment https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/#findComment-1276672 Share on other sites More sharing options...
joel24 Posted October 7, 2011 Share Posted October 7, 2011 or even using a foreach $bcc=array; foreach ($_POST as $key=>$value) { if (strpos($key,'email')!==false && !empty($value)) { $bcc[]=$value; } } $bcc=implode(",",$bcc); Quote Link to comment https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/#findComment-1276675 Share on other sites More sharing options...
conan318 Posted October 7, 2011 Author Share Posted October 7, 2011 ok ok when i tested the script i sent it to test@hotmail.com so if one of the emails fails the emails after that will fail? Quote Link to comment https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/#findComment-1276730 Share on other sites More sharing options...
Buddski Posted October 7, 2011 Share Posted October 7, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/248600-php-mail-bcc-not-working/#findComment-1276734 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.