163的邮件用phpmailer发送(实例详解)
代码如下:
<?php require_once('../class.phpmailer.php'); $mail= new PHPMailer(); $body= "我终于发送邮件成功了!呵呵!<br/><a>http://news.qq.com/a/20111115/000792.htm?qq=0&ADUIN=594873950&ADSESSION=1321316731&ADTAG=CLIENT.QQ.3493_.0</a>"; //采用SMTP发送邮件 $mail->IsSMTP(); //邮件服务器 $mail->Host = "smtp.163.com"; $mail->SMTPDebug = 0; //使用SMPT验证 $mail->SMTPAuth = true; //SMTP验证的用户名称 $mail->Username = "********@163.com"; //SMTP验证的秘密 $mail->Password = "***"; //设置编码格式 $mail->CharSet = "utf-8"; //设置主题 $mail->Subject = "测试"; //$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; //设置发送者 $mail->SetFrom('****@163.com', 'test'); //采用html格式发送邮件 $mail->MsgHTML($body); //接受者邮件名称 $mail->AddAddress("***@163.com", "test");//发送邮件 if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; }
相关推荐
Skyline 2020-05-14
poplpsure 2020-04-07
hedongli 2019-12-31
缘起宇轩阁 2019-11-08
igogo00 2019-10-23
xuebingnan 2019-09-03
一个过客 2017-08-18
whucaodi 2012-09-24
会写code的凳子哥 2016-01-16
olyqcool 2015-09-02
ahxxx 2019-06-27
xishizhaohua 2019-06-26
lbcmail 2019-06-26
微麦PHP 2019-06-26
superhosts 2019-06-26
ahxxx 2019-06-25
怕什么真理无穷 2019-06-25