宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

我是Phpmailer的新手,我正在使用它从一个noreply帐户向超过一千人发送批量电子邮件.当我向一两个人发送电子邮件时,代码工作正常,但当我发送给每个人(包括我自己)时,它会转到垃圾邮件.另一个问题是电子邮件的详细信息,它显示了发送给它的所有人的电子邮件ID,我不希望它这样做.

代码如下:

//date_default_timezone_set(‘America/Toronto’);

require_once(‘../class.phpmailer.php’);

//include(“class.smtp.php”); // optional, gets called from within class.phpmailer.php if not already loaded

$mail = new PHPMailer();

$mail->IsSMTP(); // telling the class to use SMTP

$mail->Host = “smtp1.site.com;smtp2.site.com”;

$mail->SMTPAuth = true;// enable SMTP authentication

$mail->SMTPKeepAlive = true;// SMTP connection will not close after each email sent

$mail->Host = “mail.yourdomain.com”; // sets the SMTP server

$mail->Port = 26; // set the SMTP port for the server

$mail->Username = “yourname@yourdomain”; // SMTP account username

$mail->Password = “yourpassword”; // SMTP account password

$mail->SetFrom(‘noreply@mydomain.com’, ‘List manager’);

$mail->AddReplyTo(‘list@mydomain.com’, ‘List manager’);

$mail->Subject = ‘Newsletter’;

$ids = mysql_query($select, $connection) or die(mysql_error());

while ($row = mysql_fetch_row($ids)) {

$mail->AltBody = “To view the message, please use an HTML compatible email viewer!”;

$mail->MsgHTML($body);

$mail->AddAddress($row[0]);

$mail->Send();//Sends the email

}