您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

利用phpmailer 发送邮件代码[发送html内容]

2024/4/13 11:24:30发布9次查看
我们利用 phpmailer功能实现邮件发送功能哦,这里还利用了模板呢,就是读取指定文件内容再发送给朋友.
issmtp(); // set mailer to use smtp$mail->host = smtp.163.com; // smtp1.example.com;smtp2.example.comspecify main and backup server$mail->smtpauth = true; // turn on smtp authentication$mail->username = mailangel123; // smtp username$mail->password = ******; // smtp password$mail->from = mailangel123@163.com;$mail->fromname = 你的好友来信;$mailbody = getcontent($type);//$array =explode('|',$rs['mail']);foreach ($array as $tmpmail) { if (@preg_match(/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/, $tmpmail) || strlen($user_mail) addreplyto(mailangel123@163.com, 44); $mail->addaddress($tmpmail, '您好!'); $mail->wordwrap = 50; $mail->charset = gb2312; //$mail->addattachment(/var/tmp/file.tar.gz); //$mail->addattachment(/tmp/image.jpg, new.jpg); $mail->ishtml(true); $mail->subject = 你的朋友邀请你一起合影!; $mail->body = $mailbody; if (!$mail->send()) { $bad++; $mail->clearaddresses(); $mail->clearattachments(); } else { $count++; } } showmsg(result:$count);}?>
下面这个文章是读取html 文档并进行html发送哦,
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product