【发布时间】:2015-05-14 02:44:52
【问题描述】:
我正在尝试使用 PHPMailer 和我的 SMTP 服务器向 1500 个用户发送 NewsLetter。
我已尝试将邮件发送到 2 封密件抄送电子邮件进行测试,并成功发送邮件。 但在我继续将邮件发送到 1500 电子邮件地址之前,我有几个问题。
我正在使用这个代码sn-p。
<?php
require "../PHPMailer-master/PHPMailerAutoload.php";
$bcc_list = array('emailaddrs1,emailaddress2');
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.myserver.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.myserver.com"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "mailer@myserver.com"; // SMTP account username
$mail->Password = "mypasss"; // SMTP account password
$mail->SetFrom('mailer@myserver.com', 'myserver Support');
$mail->AddReplyTo("mailer@myserver.com","myserver Support");
$mail->Subject = "Email sent from xampp";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "support@myserver.com";
$mail->AddAddress($address, "support@myserver.com");
foreach($bcc_list as $bcc_email){
$mail->AddBCC($bcc_email);
}
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
//insert that emaill address into database for re-emailing.
} else {
echo "Message sent!";
}
1) 我怎样才能让电子邮件在<To> 字段中显示用户的电子邮件地址而不是我的虚拟地址?
2) 它是作为 1 封电子邮件还是 1500 封电子邮件发送? 即,我如何才能捕获哪些电子邮件已成功发送,哪些电子邮件已成功发送(由于某些超时或出现问题),以便我可以再次发送它们,而不必向所有其他人发送垃圾邮件?
【问题讨论】:
-
我很确定它实际上是内置在电子邮件协议中的,您无法检测到哪些是成功的。否则,此信息可能会被恶意使用以发现电子邮件地址以发送垃圾邮件。
-
@Sildoreth 我不是想找到哪个邮箱,我只是想找到我成功发送的那个,以防出现问题,例如脚本超时、大延迟和/或 SMTP服务器关闭连接,或将我踢出或限制密件抄送计数。