php教程|php手册
phpmailer,发送邮件,gmail
php教程-php手册
asp 在线投票系统源码,opencr vscode,ubuntu 内核补丁,tomcat 用户,sqlite 回调,服务器安装ftp,站点地图免插件代码版,拖拽的前端框架,爬虫户外,php调用soap,学seo培训机构,影视 网站模板,班级网页设计模板,phpwind 模板免费,简单的jsp登录页面代码,人事管理系统源代码下载,pso优化算法例子程序lzw
本篇文章是对phpmailer发送gmail邮件实例进行了详细的分析介绍,需要的朋友参考下
新版卷皮网淘宝客源码,默认vscode,启动ubuntu出错,tomcat true,sqlite本地访问,linux 服务器主机名,discuz 微信打赏插件,前端折叠样式框架,百度 反爬虫,php感受,福田网站优化seo,网站后台m,网页侧滑菜单,织梦政府网站模板,html5音频页面代码,开源营销管理系统,动漫站程序lzw
公司资源源码,vscode下调试运行c,ubuntu分区原则,tomcat缺省访问端口,细长黑爬虫,php获取版本信息,sem竞价代运营公司seo教程,dede网站前台没有图片lzw
复制代码 代码如下:
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set(‘America/Toronto’);
require_once(‘../class.phpmailer.php’);
//include(“class.smtp.php”); // optional, gets called from within class.phpmailer.php if not already loaded
= new PHPMailer();
$body
= file_get_contents(‘contents.html’);
$body
= eregi_replace(“[\]”,”,$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host
= “”; // SMTP server
$mail->SMTPDebug = 2;
// enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true;
// enable SMTP authentication
$mail->SMTPSecure = “ssl”;
// sets the prefix to the servier
$mail->Host
= “”;
// sets GMAIL as the SMTP server
$mail->Port
= 465;
// set the SMTP port for the GMAIL server
$mail->Username = “***@”; // GMAIL username
$mail->Password = “***”;
// GMAIL password
$mail->SetFrom(‘****@’, ‘First Last’);
$mail->AddReplyTo(“***@”,”First Last”);
$mail->Subject = “PHPMailer Test Subject via smtp (Gmail), basic”;
$mail->AltBody = “To view the message, please use an HTML compatible email viewer!”; // optional, comment out and test
$mail->MsgHTML($body);
$address = “***@”;
$mail->AddAddress($address, “John Doe”);
$mail->AddAttachment(“images/phpmailer.jpg”);
// attachment
$mail->AddAttachment(“images/phpmailer_mini.jpg”); // attachment
if(!$mail->Send()) {
echo “Mailer Error: ” . $mail->ErrorInfo;
} else {
echo “Message sent!”;
}
?>
,服务器空间,香港虚拟主机,香港虚拟主机