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

PHPMailer邮件发送

2025/12/11 0:01:42发布8次查看
引用文件phpmailerautoload.php、class.phpmailer.php、class.smtp.php
实例化应用文件index.php
issmtp();
//enable smtp debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->smtpdebug = 2;
//ask for html-friendly debug output
$mail->debugoutput = 'html';
//set the hostname of the mail server
$mail->host = smtp.qq.com;
//set the smtp port number - likely to be 25, 465 or 587
$mail->port = 25;
//whether to use smtp authentication
$mail->smtpauth = true;
//username to use for smtp authentication
$mail->username = ###@qq.com;//发送人email及姓名
//password to use for smtp authentication
$mail->password = ####;;//发送人密码及姓名
//set who the message is to be sent from
$mail->setfrom('####@qq.com', 'first last');//发送人email及姓名
//set an alternative reply-to address
$mail->addreplyto('###@qq.com', 'first last');//发送人email及姓名
//set who the message is to be sent to
$mail->addaddress('###@qq.com', 'john doe');//收件人email及姓名
//set the subject line
$mail->subject = 'phpmailer smtp test';
//read an html message body from an external file, convert referenced images to embedded,
//convert html into a basic plain-text alternative body
$mail->msghtml(adwawdawd);
//replace the plain text body with one created manually
$mail->altbody = 'this is a plain-text message body';
//attach an image file
//$mail->addattachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo mailer error: . $mail->errorinfo;
} else {
echo message sent!;
}
?>
发送人的使用qq邮件需要在qq邮箱里面配置qq邮箱的邮件服务器
以上就介绍了phpmailer邮件发送,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
十堰分类信息网,免费分类信息发布

VIP推荐

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