Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. class Magicmailer extends \PHPMailer{
  4.  
  5.     function __construct() {
  6.         parent::__construct();
  7.  
  8.         $config     = ConfigModel::first();
  9.  
  10.         $this->isSMTP();                                      // Set mailer to use SMTP
  11.         $this->setFrom($_ENV['EMAIL_USER'], $config->name);
  12.         $this->Host = $_ENV['EMAIL_HOST'];  // Specify main and backup SMTP servers
  13.         $this->SMTPAuth = true;                               // Enable SMTP authentication
  14.         $this->Username = $_ENV['EMAIL_USER'];                 // SMTP username
  15.         $this->Password = $_ENV['EMAIL_PASS'];                           // SMTP password
  16.         $this->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
  17.         $this->isHTML(true);
  18.         $this->Port = $_ENV['EMAIL_PORT'];
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement