zoukankan      html  css  js  c++  java
  • HelpersPHPMailer

    HelpersPHPMailer

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

    Make an alias:

    use HelpersPhpMailerMail;

    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.

  • 相关阅读:
    USACO Name That Number
    USACO Milking Cows
    hdu 1540 Tunnel Warfare (线段树维护左右最长连续区间)
    Contest 1
    JNU周练1026
    树形DP
    Python和C扩展实现方法
    Python模拟C++输出流
    SkipList算法实现
    Python 迭代dict 效率
  • 原文地址:https://www.cnblogs.com/chunguang/p/5643190.html
Copyright © 2011-2022 走看看