【发布时间】:2018-07-12 08:35:20
【问题描述】:
我正在尝试通过密件抄送发送电子邮件,我原以为它们是隐藏的,但似乎没有。也许我的代码不正确?
// grab all emails from txt file
$myfile = fopen("database-email.txt", "r") or die("Unable to open file!");
$allEmails = fread($myfile,filesize("database-email.txt"));
fclose($myfile);
$afzender = "noreply@wisselslag.nl";
$to = 'pj.maessen41@live.nl';
$subject = 'Nieuwsbrief de Wisselslag';
$headers = "From: " . $afzender . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "Bcc: " . $allEmails . "\r\n";
if (mail($to, $subject, $message, $headers)) {
echo 'Bericht is verstuurd!';
} else {
echo 'There was a problem sending the email.';
}
所以我有一个 database-email.txt 文件,其中存储了所有电子邮件,逗号彼此分隔,如下所示:
joey.tims@gmail.com,
j.maessen@online.nl,
john.doe@live.nl,
diana.johnson@hotmail.com,
发送到我的 gmail 帐户时,我可以看到:
这怎么可能我可以看到电子邮件也发送到哪里?
【问题讨论】:
-
$afzender有值吗? -
$afzender = "noreply@wisselslag.nl; -
电子邮件的收件人始终可以看到“收件人”和“抄送”列表。只有“密件抄送”列表被隐藏
-
是的,应该隐藏密件抄送。但我可以看到整个密件抄送列表
-
您的问题似乎是文件中的换行符导致第一个地址之后的任何地址被放置在电子邮件正文中。只需删除换行符