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('noreply@domain.com');
$mail->addAddress('user@domain.com');
$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     = 'noreply@domain.com';
public $FromName = SITETITLE;
public $Host = 'smtp.gmail.com';
public $Mailer = 'smtp';
public $SMTPAuth = true;
public $Username = 'email@domain.com';
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.

最新文章

  1. C 小复习
  2. 实体框架 (EF) 入门 =&gt; 六、性能注意事项
  3. JSP的7个动作指令
  4. MySQL数据库远程连接开启方法
  5. 数据结构(C语言版)---第三章栈和队列 3.4.2 队列的链式表示和实现(循环队列)
  6. 不使用CvvImage类来在MFC中显示图像
  7. C++ notes for beginners(2)
  8. Java并发编程--Fork/Join框架使用
  9. g1gc
  10. RadioGroup
  11. 关于jQuery表单选择中prop和attr的区别。
  12. spark2.2 DataFrame的一些算子操作
  13. 设计模式-行为型模式,python备忘录模式
  14. Django之缓存
  15. wamp添加本地虚拟域名
  16. SQL备份数据库代码
  17. phpcms模块开发中的小问题及解决方法
  18. (二分搜索 数论)(求阶乘里零个数对应的阶乘)light oj -- 1138
  19. Android 弹出框Dialog并缩放图片
  20. 行驶证识别/行驶证OCR识别全方位解析

热门文章

  1. linux-制作linux启动U盘
  2. 添加删除ASM磁盘
  3. 如何利用WordPress创建自定义注册表单插件
  4. PageRank与社交网络模型评估
  5. 二、python 函数
  6. 使用SignalR实现比特币价格实时刷新
  7. delphi 单例模式实现
  8. New full duplex HTTP tunnel implementation (client and server)
  9. Red5下的room
  10. SaltStack安装Redis模块