首页 > 开发 > PHP > 正文

PHP实现邮件群发的源码

2024-05-04 22:25:41
字体:
来源:转载
供稿:网友
代码如下:
 <?php
 // 请求 PHPmailer类 文件
 require_once("class.phpmailer.php"); 

 //发送Email函数
 function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {
 $mail = new PHPMailer(); 
 $mail->IsSMTP();                                     // send via SMTP 
 $mail->Host = "smtp.163.com";                       // SMTP servers 
 $mail->SMTPAuth = true;                             // turn on SMTP authentication 
 $mail->Username = "jessiejl";                          // SMTP username     注意:普通邮件认证不需要加 @域名
 $mail->Password = "1983106";                         // SMTP password 

 $mail->From = "";                      // 发件人邮箱
 $mail->FromName = "WWW.NIUTW.COM";                 //   发件人 ,比如 唯美搭配网

 $mail->CharSet = "GB2312";                          // 这里指定字符集!
 $mail->Encoding = "base64"; 

 $mail->AddAddress($sendto_email,$user_name);        // 收件人邮箱和姓名
 $mail->AddReplyTo("","Web之家"); 

 //$mail->WordWrap = 50; // set word wrap 
 //$mail->AddAttachment("/var/tmp/file.tar.gz");                                                    // attachment  附件1
 //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");                                         //附件2
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表