1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > php批量发邮件 使用phpmailer发送批量邮件

php批量发邮件 使用phpmailer发送批量邮件

时间:2021-01-31 20:41:38

相关推荐

php批量发邮件 使用phpmailer发送批量邮件

我是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 = ";";

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

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

$mail->Host = ""; // 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@', 'List manager');

$mail->AddReplyTo('list@', '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

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。