Home > php教程 > php手册 > 2013/8/29 TP发送邮件 <技巧类>

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

WBOY
Release: 2016-06-13 11:31:33
Original
1098 people have browsed it

 

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();

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template