【问题标题】:sending email to multiple recipients not see other users addresses向多个收件人发送电子邮件看不到其他用户地址
【发布时间】:2013-11-27 07:10:37
【问题描述】:

你好朋友我通过管理面板在他们的电子邮件地址上发送注册用户激活链接和代码,它工作正常用户可以获得激活链接和代码。

但问题是users can see other recipients email address In To: 我希望用户看不到其他收件人的电子邮件地址?

这是我的代码

<?php 
//creating activation code
$alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$length = 11;
for($i=0; $i<$length; $i++){
$ran = rand(0, strlen($alpha)-1);
$new_key .= substr($alpha, $ran, 1);
}   


$activation = 'activation.php?email='.urlencode($_POST['email1']).'&key='.$new_key;
$your_email = 'test@test.com'; 
$domain = $_SERVER["HTTP_HOST"];
$to = implode(',', $_POST['email1']);
$subject = 'Confirmation';
$message = '<font class="font1">
<a href="http://'.$domain.'/'.$activation.'">http://'.$domain.'/'.$activation.'</a></font>';

$headers .= 'MIME-Version: 1.0' . "\r\n";  
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
$headers .= "From: <$your_email>\r\n" .  
"X-Mailer: PHP/" . phpversion(); 

mail($to, $subject, $message, $headers);
?>

选择用户电子邮件地址的表单

<form name ="checkForm" id="checkForm" method="post">  
<?php 
$query=mysql_query("select semail from students order by id") 
or die ('students query');

while($row=mysql_fetch_array($query))
{
?>

<input type="text" name="email1[]" value="<?php echo $row['semail'] ?>"  />

<?php } ?> 

</form>

【问题讨论】:

  • 发送多封电子邮件,而不是一封...或者只是将它们添加为密件抄送。
  • 可以,但用户可以看到其他recipients email address
  • 只需循环邮件功能,发送给每个用户

标签: php email


【解决方案1】:

使用密件抄送

$headers .= 'From: Your Name <test@test.com' . "\r\n";
$headers .= 'BCC: '.  implode(',', $_POST['email1']) . "\r\n";

mail(null, $title, $content, $headers);

【讨论】:

  • 如果我使用密件抄送,那该怎么办??这可能是密件抄送而不是密件抄送吗?
  • 通常您将自己添加为“收件人”,因为您要发送给的每个人都可以毫无问题地看到您的电子邮件。
  • 也可以设为null
  • 感谢 shafeeq 它正在工作,但是 TO IS BLANK IN The EMail
  • 从你的名字看标题
猜你喜欢
  • 2013-09-07
  • 2011-03-13
  • 1970-01-01
  • 2012-05-18
  • 2013-07-17
  • 2011-05-18
  • 2021-06-27
相关资源
最近更新 更多