有关phpmailer的详细介绍及使用方法
来源:才华咖 本文已影响2.62W人
来源:才华咖 本文已影响2.62W人
有关phpmailer的用法,有需要的朋友不妨参考下,就跟随本站小编一起去了解下吧,想了解更多相关信息请持续关注我们应届毕业生考试网!
第一,需要下载PHPMailer文件包phpmailer.
第二,确认你的服务器系统已经支持socket ,通过phpinfo();查看是否支持sockets(socket 是属于PHP扩展部分),如果显现为“enabled”,那就是支持了。
第三,把文件解压到你的web服务器目录下,调用类就可以了.
首先包含,然后创建对象,设置参数,调用成员函数。
例1,做成函数方便调用
复制代码 代码如下:
<?php
require("phpmailer/");
function smtp_mail( $sendto_email, $subject, $body, $extra_hdrs, $user_name){
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = ""; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "yourmail"; // SMTP username 注意:普通邮件认证不需要加 @域名
$mail->Password = "mailPassword"; // SMTP password
$mail->From = "; // 发件人邮箱
$mail->FromName = "管理员"; // 发件人
$mail->CharSet = "GB2312"; // 这里指定字符集!
$mail->Encoding = "base64";
$mail->AddAddress($sendto_email,"username"); // 收件人邮箱和姓名
$","");
//$mail->WordWrap = 50; // set word wrap 换行字数
//$mail->AddAttachment("/var/tmp/"); // attachment 附件
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
$mail->IsHTML(true); // send as HTML
// 邮件主题
$mail->Subject = $subject;
// 邮件内容
$mail->Body = "
<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
</head>
<body>
I love php。
</body>
</html>
";
PHP如何使用DOM和simplexml读取xml文档
有关javascript在IE下trim函数无法使用的解决方法
PHP中trait的使用方法介绍
关于异步JavaScript编程中的Promise使用方法
PHP中使用XML-RPC构造Web Service简单入门
Let A Miracle Happen英语美文
PHP中trait使用方法介绍
浅谈PHP扩展模块Pecl和Pear以及Perl的区别
Jolie drops battle over perfume named Shilohy英语作文
java script remove Child的使用注意事项
详解JavaScript中的splice()使用方法
Thinkpad笔记本开机显示Tointerrruptnormalstartup解决方法
PHP中使用curl方法介绍
PHP中strtotime函数使用方法详解
英语演讲稿《 I Am Tripping My Elephant Here》
PHP 表单验证 E-mail 和 URL
英语六级写作parallelism的使用技巧
A happy summer holiday英语作文
linux上使用strace查看C语言级别的php源码的方法
PHP中strtotime函数使用方法
自我介绍的分类及细节
离职报告写法详细介绍
HTML5中drawImage使用时遇到的问题及解决方法
WinXP如何安装Apache+MySQL+PHP环境
无线咪的介绍和使用方法
php中set-error-handler的用法
The summer holiday plan英语作文
php字符串替换函数str-replace速度比preg-replace快
GET.CELL函数的详细用法及实例介绍
Javascript中arguments对象的详解和使用方法
有关PHP字符串比较函数strcmp()和strcasecmp()使用总结
php安装xdebug/pear/phpunit图文详解
php错误提示failed to open stream
Linux+Apache+Mysql+PHP优化技巧
英语四级作文The Importance of Physical Exercise
php函数method-exists()与is-callable()有何区别
php的set-error-handler用法总结
Dreamweaver中JavaScript行为操作使用方法
少儿英语小故事:She Practices Flips for the Olympic
Adobe Premiere Pro CC 2017 (Win|Mac)中文版功能介绍