最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
phpmailer多邮件发送
时间:2022-07-02 10:31:58 编辑:袖梨 来源:一聚教程网
phpmailer多邮件发送
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->From = "[email protected]";
$mail->FromName = "List manager";
$mail->Host = "smtp1.site.com;smtp2.site.com";
$mail->Mailer = "smtp";
@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);
while ($row = mysql_fetch_array ($result)) {
// HTML body
$body = "Hello " . $row["full_name"] . ",
";
$body .= "Your personal photograph to this message.
";
$body .= "Sincerely,
";
$body .= "PHPMailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", ";
$text_body .= "Your personal photograph to this message. ";
$text_body .= "Sincerely, ";
$text_body .= "PHPMailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "
";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}
相关文章
- 烽烟手游新手怎么玩 新手入门玩法详细攻略 03-25
- 《暗区突围》S17赛季诡雾山谷即将来袭 03-25
- 流行的手机飞机游戏排行榜前十名 免费的飞机游戏盘点2026 03-25
- 《草图大师》调颜色教程 03-25
- 爱探险的朵拉游戏下载推荐 经典的朵拉游戏排行2026 03-25
- 有趣的4x4越野游戏手机版下载 好玩的越野车游戏合集2026 03-25