问题描述
我知道有一些与此相似的问题,但我无法使其正常工作。在一个名为$ emailList的变量中。
如果我将变量放在 $到
部分但
我不能让它工作,我可以得到我的代码从窗体发送电子邮件与bcc。我甚至添加了一封电子邮件到 $到
,这是,但它没有什么不同。
这是我的代码。
$ to =name @ mydomain.com;
$ subject。=。$ emailSubject。;
$ headers。='Bcc:$ emailList';
$ headers =From:[email protected]\r\\\
。 X-Mailer:php;
$ headers。=MIME-Version:1.0\r\\\
;
$ headers。=Content-Type:text / html; charset = ISO-8859-1\r\\\
;
$ message ='< html>< body>';
$ message。='从形式的信息';
if(mail($ to,$ subject,$ message,$ headers)){
$ sent =你的电子邮件已发送!
} else {
$ sent =(发送电子邮件时发生错误);
}
我已尝试过两个代码:
$ headers。='Bcc:$ emailList';
和
$ headers。='Bcc:'。$ emailList。';
这不是电子邮件没有分开,因为它们是。我知道这是因为如果我在 您有 只需将 在一边注意,通常需要 I know there are a few similar questions to this but I just can't get it working. Ok, I have a list of emails grabbed from my database in a variable called $emailList.I can get my code to send an email from a form if I put the variable in the Here is my code. I've tried both codes: and It's not that the emails aren't separated because they are. I know they are because it works if I put I Should add, ignore the You have Just put the On a side note, the 这篇关于PHP电子邮件发送BCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! $ to
部分中放入 $ emailList
。我应该添加,忽略 $ headers。='...';
其次是 $ headers ='...';
;第二行是覆盖第一行。
$ headers。=Bcc:$ emailList\r\\\
在
; 内容类型
行后面说,这应该是正常的。
To
邮件服务器可能将您的邮件标记为垃圾邮件。
$ headers =From:[email protected]\\ \\\\。
X-Mailer:php\r\\\
;
$ headers。=MIME-Version:1.0\r\\\
;
$ headers。=Content-Type:text / html; charset = ISO-8859-1\r\\\
;
$ headers。=Bcc:$ emailList\r\\\
;
$to
section butI cannot get it to work with bcc. I've even added an email to the $to
incase it was that but it doesn't make a difference. $to = "[email protected]";
$subject .= "".$emailSubject."";
$headers .= 'Bcc: $emailList';
$headers = "From: [email protected]\r\n" . "X-Mailer: php";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= 'THE MESSAGE FROM THE FORM';
if (mail($to, $subject, $message, $headers)) {
$sent = "Your email was sent!";
} else {
$sent = ("Error sending email.");
}
$headers .= 'Bcc: $emailList';
$headers .= 'Bcc: '.$emailList.';
$emailList
in the $to
section. $message
bits and the HTML stuff. I've not provided all of that so that is why it's missing from this code. $headers .= '...';
followed by $headers = '...';
; the second line is overwriting the first.$headers .= "Bcc: $emailList\r\n";
say after the Content-type
line and it should be fine.To
is generally required; mail servers might mark your message as spam otherwise.$headers = "From: [email protected]\r\n" .
"X-Mailer: php\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "Bcc: $emailList\r\n";