Heim  >  Artikel  >  Backend-Entwicklung  >  2013/8/29 TP发送邮件 <技巧类>_PHP教程

2013/8/29 TP发送邮件 <技巧类>_PHP教程

WBOY
WBOYOriginal
2016-07-20 11:15:49831Durchsuche

 

1.导入类文件mail,并创建对象

import('ORG.Com.Phpmailer');

$mail=new PHPMailer();

2.设置信息

$mail->IsSMTP();                     //设置使用SMTP服务器发送
$mail->Host = "smtp.126.com";             //设置126邮箱服务
$mail->SMTPAuth = true;                 // 设置需要验证
$mail->Username = "kongxiangshuaihe@126.com";    // 发件人使用邮箱
$mail->Password = "538567";               // 设置发件人密码

$mail->From = "heitiane@126.com";      // 发件人邮箱
$mail->FromName = "yi时网";               //发送者名称
$mail->AddAddress('666@qq.com');              // 添加发送地址

$mail->IsHTML(true);                   //指定支持html格式
$mail->CharSet="UTF-8";                //指定字符集

$mail->Subject = "激活帐号";               //邮件标题   
$mail->Body = "帐号已经激活,点击跳转localhost/demo.jpg";  //邮件内容,可以加标签

3.发送邮件,成功返回true 失败false

 $mail->Send();

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440153.htmlTechArticle1.导入类文件mail,并创建对象 import('ORG.Com.Phpmailer'); $mail=new PHPMailer(); 2.设置信息 $mail-IsSMTP(); //设置使用SMTP服务器发送 $mail-Host = "smtp.126....
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn