Helpers\PHPMailer

Helpers\PHPMailer

PHPMailer is a third party class for sending emails, Full docs are available athttps://github.com/Synchro/PHPMailer

Make an alias:

use Helpers\PhpMailer\Mail;

To use PHPMailer create a new instance of it:

$mail = new Mail();

Once an instance has been created all the properties are available to you, a typical example:

$mail = new Mail();
$mail->setFrom(‘[email protected]‘);
$mail->addAddress(‘[email protected]‘);
$mail->subject(‘Important Email‘);
$mail->body("<h1>Hey</h1><p>I like this <b>Bold</b> Text!</p>");
$mail->send();

To use gmail use at your own risk!! You must enable an option in order to allow to send email through gmail goto https://myaccount.google.com/security#connectedapps login and enable Allow access to less secure apps.

The class has the ability to send via SMTP in order to do so edit Helpers/PhpMailer/Mail.php and enter your SMTP settings you can also set a default email from address so you don‘t have to supply it each time:

public $From     = ‘[email protected]‘;
public $FromName = SITETITLE;
public $Host     = ‘smtp.gmail.com‘;
public $Mailer   = ‘smtp‘;
public $SMTPAuth = true;
public $Username = ‘[email protected]‘;
public $Password = ‘password‘;
public $SMTPSecure = ‘tls‘;
public $WordWrap = 75;

You don‘t need to specify a plain text version of the email to be sent out, this is done automatically from the supplied body.

时间: 2024-08-03 15:11:37

Helpers\PHPMailer的相关文章

Helpers Overview

Helpers Overview Helpers are classes that are not part of the core system but can greatly improve it by adding new features and possibilities. This section documents the included helpers and how to use them. Since helpers are classes they can be adde

php用phpmailer发送邮件

发送邮件 1.为了保证安全性,需要生成发送到邮件的URL,主要参数(key(key 需要在每次运行是自动生成随机码))   然后将URL发送到邮箱. 2.解析url:首先根据用户名从数据库中查找出密钥key和过期时间,没有则表示该请求 是伪造的或者过期的,然后验证签名,验证过期时间,都验证通过,就可以修改密码, 密码修改完以后,删除数据库中的记录. 注:但我并没有用数据库,而是用的redis. 链接上只用一个唯一码,根据唯一码到redis中获取用户的guid,而且是3600秒后连接失效(redi

PHP中利用PHPMailer配合QQ邮箱实现发邮件

由于项目的需要,要实现给我们的网站用户发送邮件,于是就有了这篇博客.以下的内容是我结合网上的例子加上自己的实践的出来的.希望对大家有帮助. PHPMailer的介绍: 优点: 可运行在任何平台之上 支持SMTP验证 发送邮时指定多个收件人,抄送地址,暗送地址和回复地址:注:添加抄送.暗送仅win平台下smtp方式支持 支持多种邮件编码包括:8bit,base64,binary和quoted-printable 支持冗余SMTP服务器,即可以指定主smtp服务器地址也只可以指定备份smtp服务器

使用 PHPMailer 发送邮件

PHPMailer 的官方站点:http://phpmailer.worxware.com/ PHPMailer GitHub 下载地址:https://github.com/Synchro/PHPMailer 用法,详见代码清单: <?php header('Content-Type:text/html;Charset=utf-8'); require './PHPMailerAutoload.php'; $mail = new PHPMailer; $mail->isSMTP(); //

20150322 利用phpmailer来发送邮件

20150322 利用phpmailer来发送邮件 2015-03-22 Lover雪儿 ? 前面我们实现了phpmailer来发送邮件,此处我们来实现利用pop3来收取邮件. http://www.cnblogs.com/lihaiyan/p/4356704.html ? 常用命令: telnet pop3.163.com 110 ctrl + ] 开启回显功能 user 用户名 pass 密码 stat 统计 返回邮件数量 及 所占 总空间 top 邮件号 行号 ,查看邮件头 邮件从旧到新递

用phpmailer发送邮件提示SMTP Error: Could not connect to SMTP host解决办法

之前做项目的时候做了一个用phpmailer发送邮件的功能<CI框架结合PHPmailer发送邮件>,昨天步署上线(刚开始用新浪云,嫌贵,换成阿里了),测试的时候,发送邮件却意外报错了.......... 我擦,没上线的时候好好的,次次成功,刚开始我以为是smtp地址的问题(我用的163邮箱),后来改成了QQ邮箱,发现还是没有用,没办法,只好问度娘了,后来看着百度上的答案才明白除了google的smtp服务器收到请求"smtp"会接受,其他的服务器就像我用的163,QQ什么

将PHPMailer整合到ThinkPHP 3.2 中实现SMTP发送邮件

本内容转载出处:http://my.oschina.net/BearCatYN/blog/299192,并做了一处修改. ThinkPHP没有邮件发送的功能,于是,我就想了想,就将PHPMailer整合到ThinkPHP中吧. PHPMailer是不符合ThinkPHP规范的插件程序,所以,我们需要先将PHPMailer程序放到ThinkPHP的 Library/Vendor目录下,我这里是最新版的ThinkPHP 3.2,如果是是ThinkPHP 3.2之前的版本,可能就是Lib目录了.Ven

利用phpmailer类邮件发送

<?php require("class.phpmailer.php"); //下载的文件必须放在该文件所在目录 $mail = new PHPMailer(); //建立邮件发送类 $address = "接收方邮箱"; //接收方地址 $mail->IsSMTP(); //使用SMTP方式发送 $mail->Host = "发送者邮箱smtp"; //您的企业邮局域名 $mail->SMTPAuth = true; /

PHPMailer fe v4.11 For Thinkphp 3.2

PHPMailer fe v4.11 For Thinkphp 3.2,你值得拥有! 今晚用TP3.2开发一个东西的时候需要邮件发送功能,理所当然的想到了PHPMailer.于是有了此文!---------------------------- 将 Controller 中的文件复制到 Application\Home\Controller 将 Util 中的文件复制到 Application\Common\Util 然后访问 /index.php?m=Home&c=Demo&a=mail