phpmailer多邮件发送

phpmailer多邮件发送

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From     = "list@mydomain.com";
$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 <font size="4">" . $row["full_name"] . "</font>, <p>";
    $body .= "<i>Your</i> personal photograph to this message.<p>";
    $body .= "Sincerely, <br>";
    $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"] . "<br>";

    // Clear all addresses and attachments for next loop
    $mail->ClearAddresses();
    $mail->ClearAttachments();
}
   

时间: 2024-07-31 16:45:02

phpmailer多邮件发送的相关文章

使用PHPMailer实现邮件发送代码分享_php实例

发送邮件是常用的功能,LZ今天在项目中也碰到了,特此分享一下. 首先,去下载PHPMailer 1.https://github.com/dwqs/PHPMailer 2.http://download.csdn.net/detail/u011043843/8063583 下载之后,将文件解压到项目目录的对应位置,将class.phpmailer.php和class.smtp.php引入项目中,看代码:(解压的文件不要删除,否则不行) <?php // 必要导入 require("clas

ThinkPHP利用PHPMailer实现邮件发送实现代码_php实例

本文所使用的是ThinkPHP 2.1版和 PHPMailer 5.1版.(后者建议您直接从本博下载,因为我们不能保证下面的代码在所有版本的PHPMailer中都能正常运行) 下面是具体步骤: 第一步.添加PHPMailer类库 点击此处下载将下载后的文件解压,将PHPMail目录移动至ThinkPHP目录中的Vendor内.(请确保class.phpmailer.php文件就在ThinkPHPVendorPHPMailerclass.phpmailer.php) 第二步.添加发送邮件函数 在项

ThinkPHP 利用 PHPMailer 实现邮件发送

本文所使用的是ThinkPHP 2.1版和 PHPMailer 5.1版.(后者建议您直接从本博下载,因为我们不能保证下面的代码在所有版本的PHPMailer中都能正常运行) 下面是具体步骤: 第一步.添加PHPMailer类库 点击此处下载 将下载后的文件解压,将PHPMail目录移动至ThinkPHP目录中的Vendor内.(请确保class.phpmailer.php文件就在ThinkPHPVendorPHPMailerclass.phpmailer.php) 第二步.添加发送邮件函数 在

PHP邮件发送类

Swift Mailer 和前面介绍的PHPMailer一样,也是一个PHP邮件发送类.它不依赖于 PHP 自带的mail() 函数,因为该函数在发送多个邮件时占用的系统资源很高.Swift 直接与 SMTP 服务器通讯,具有非常高的发送速度和效率. phpmailer邮件找回密码 1.根据邮件找回链接进入重置密码操作页面 .仅一周内.一次有效 2.重置密码 (也可以将密码发送直接登录) 生成邮件找回邮件 用linux下安装的sendmail写了一个发送email的程序 Java代码   <?p

PHP邮件发送类PHPMailer用法实例详解

 本文实例讲述了PHP邮件发送类PHPMailer用法,并详细讲述了其具体的操作步骤.分享给大家供大家参考.具体步骤如下: 1.在服务器安装 sendmail 1 sudo apt-get install sendmail 2.启动 sendmail 1 sudo /etc/init.d/sendmail start 3.修改 php.ini 1 2 3 4 [mail function]  SMTP = localhost  smtp_port = 25  sendmail_from = me

phpmailer发邮件,显示发送成功,邮件却没收到

问题描述 phpmailer发邮件,显示发送成功,邮件却没收到 这是配置信息 这是提示信息 Invalid address是哪儿来的?为什么已经显示发送成功却收不到邮件? 解决方案 通过phpmailer使用gmail账号发送邮件了[转]用 phpmailer 发送邮件PHPmailer发送邮件 解决方案二: 163的邮箱里需要配置一下的

简单讲解phpmailer邮件发送例子(带源码下载地址)

我顶PHPMailer ,就如它的名字一样,是一个使用 PHP 编写的邮件发送类,同时,PHPMailer 也是一个功能强大的类. 官方网站:http://phpmailer.codeworxtech.com/ DOWNLOAD:http://code.google.com/a/apache-extras.org/p/phpmailer/ PHPMailer 的主要特点有: 1.在邮件中包含多个 TO.CC.BCC 和 REPLY-TO. 2.平台应用广泛,支持的 smtp 服务器包括 Send

PHP邮件发送类PHPMailer用法实例详解_php技巧

本文实例讲述了PHP邮件发送类PHPMailer用法,并详细讲述了其具体的操作步骤.分享给大家供大家参考.具体步骤如下: 1.在服务器安装 sendmail sudo apt-get install sendmail 2.启动 sendmail sudo /etc/init.d/sendmail start 3.修改 php.ini [mail function] SMTP = localhost smtp_port = 25 sendmail_from = me@example.com 4.F

PHPMailer邮件类邮件发送

要注意的内容: 1. 邮件的字符集设置, $mail->CharSet = "GB2312";            // 这里指定字符集!在这里我只指定为GB2312因为这样Outlook能正常显示邮件主题,我尝试过设为utf-8但在Outlook下显示乱码. 2. 如果是发送html格式的邮件,那么记得也指定<meta ... charset=GB2312"> 3. 如果你想用它来群发邮件的话,记得修改包含文件函数,如: require("ph