Home > php教程 > php手册 > php发送邮件方法二2.(SMTP传输SMTP类调用发送)

php发送邮件方法二2.(SMTP传输SMTP类调用发送)

WBOY
Release: 2016-06-13 10:50:27
Original
1007 people have browsed it

[html]
require_once("email2.php");//此为php发送邮件方法二2.(SMTP传输SMTP类) 
/** 
*服务器信息 
*/ 
$MailServer = 'smtp.163.com';      //SMTP 服务器 
$MailPort   = '25';                  //SMTP服务器端口号 默认25 
$MailId     = 'anheng123@163.com';  //服务器邮箱帐号 
$MailPw     = 'xxxxxxxxxxx';                 //服务器邮箱密码 
 
/** 
*客户端信息 
*/ 
$Title      = '系统开发人员报告错误信息';        //邮件标题 
 
$bt="sadfsadf"; 
$_POST['url']="afasdfasfasfsaf"; 
$_POST['lianxi']="12312412"; 
$_POST['xiangxi']="说的话头isa而感觉撒改的"; 
$td=$subject.'
'.'标题:'.$bt.'
'.'url:'.$_POST['url'].'
'.'联系电话:'.$_POST['lianxi'].'
'.'详细内容:'.$_POST['xiangxi']; 
 
 
 
$Content    = $td;        //邮件内容 
$email      = www.2cto.com目标 接收者邮箱 
 
 
$smtp = new smtp($MailServer,$MailPort,true,$MailId,$MailPw); 
$smtp->debug = false; 
if($smtp->sendmail($email,$MailId, $Title, $Content, "HTML")){ 
     echo '邮件发送成功';            //返回结果 
} else { 
     echo '邮件发送失败';            //$succeed = 0; 

?> 
作者:Vericlongmore

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