dor2p0520 2018-06-04 21:11
浏览 45
已采纳

$ Bcc不是为我发送电子邮件?

I am trying to send an email to several different addresses 2 being pulled from the data tables (to: and Bcc) the othere is a CC all work but the BCC address. I can swap the to address to either of the data table addresses and it will send to whichever I have there so the data is fine but the BCC just wont work for me.

Here is my code where I am pulling the BCC address from data but it does not send the BCC address. I have tried several things to remedy this all to no avail!

// fetch contestant email from 'contestants' table...
$sql = $mysqli->query("select * FROM contestants where 
id='".$_SESSION['contestantId']."'");
$row = $sql->fetch_assoc();
$name = $row['name'];

//fetch event details from 'events' table...
$sql1 = $mysqli->query("select * FROM events where 
id='".$_SESSION['event_id']."'");
$row1 = $sql1->fetch_assoc();

//fetch club details from 'clubs' table...
// fetch contestant email from 'contestants' table...
$sql2 = $mysqli->query("select * FROM clubs where 
id='".$_SESSION['clubId']."'");
$row2 = $sql2->fetch_assoc();

// fetch club admin email from 'clubs' table...
$sql3 = $mysqli->query("select * FROM clubs where 
id='".$_SESSION['clubId']."'");
$row3 = $sql3->fetch_assoc();



// send mail to contestant and CC RCBearings@aol.com...

 $to        = $row3['admin_email_address'];
 $Bcc       = $row['email'];        


 $from      = 'support@racemastersevents.com';

 // To send HTML mail, the Content-type header must be set

 $headers  = 'MIME-Version: 1.0' . "
";
 $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";


 // Create email headers
 $headers .= 'Bcc: $Bcc
';
 $headers .= 'Cc: rbearings@ao.com' . "
";
 $headers .= 'From: '.$from."
".

    'Reply-To: '.$from."
" .

    'X-Mailer: PHP/' . phpversion();



 // Compose a simple HTML email message

 $subject   = 'RaCEMastersEvents.com - Incomplete Order! (CAN)';

$message = '<html><body>';
$message .= '<h3><font color="red">RaCE</font>MastersEvents.com</h3>';
$message .= 'We are Up All Night Long, Assuring your Event gets Maximum 
Exposure!';
$message .= '<hr>';

$message .= '<h3 style="color:black;">'.$name.',</h3>';


$message .= '<p font-size:12px;">Has an incomplete Entry for your Event:<br><b> '.$row1['list_title'].'.</b><br> No Handshake between Paypal and RaCEMasters was received! To have completed this order a Paypal payment must have been made and a Click on the "Return To Merchant" button from Paypal was needed. <br><br>
Please check your Paypal Account for this payment and if received please Mark them Paid from the "Incomplete Orders link" on the "Current Entries" page.<br> If you did not receive this payment please contact <b>'.$name.'</b>, to see if he/she wishes to Pay and Complete this Entry or Cancel. If they Cancel simply "Delete the Incomplete Order!!<br>For assitance contact RCBearings@aol.com. </p>';

$message .= '</body></html>';

// Sending email

 if(mail($to, $subject, $message, $headers)){

    // echo 'Your mail has been sent successfully.';

}
/*  else{

    echo 'Unable to send email. Please try again.';

} */ 

?>
  • 写回答

1条回答 默认 最新

  • dongzi8191 2018-06-04 21:15
    关注

    You need double quotes to resolve the variable as well as the . Change

     $headers .= 'Bcc: $Bcc
    ';
    

    To

    $headers .= "Bcc: $Bcc
    ";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵