Пример #1
0
 public function __construct($group = false)
 {
     parent::__construct();
     $isSMTP = !isset($group['isSMTP']) ? MAIL_IS_SMTP : $group['isSMTP'];
     $smtpAuth = !isset($group['smtpAuth']) ? MAIL_SMTP_AUTH : $group['smtpAuth'];
     $isHTML = !isset($group['isHTML']) ? MAIL_IS_HTML : $group['isHTML'];
     $charset = !isset($group['charset']) ? MAIL_CHARSET : $group['charset'];
     $smtpSecure = !isset($group['smtpSecure']) ? MAIL_SMTP_SECURE : $group['smtpSecure'];
     $host = !isset($group['host']) ? MAIL_HOST : $group['host'];
     $port = !isset($group['port']) ? MAIL_PORT : $group['port'];
     $user = !isset($group['user']) ? MAIL_USER : $group['user'];
     $pass = !isset($group['pass']) ? MAIL_PASS : $group['pass'];
     $this->isSMTP();
     // Set mailer to use SMTP
     $this->Host = $host;
     // Specify main and backup SMTP servers
     $this->SMTPAuth = $smtpAuth;
     // Enable SMTP authentication
     $this->Username = $user;
     // SMTP username
     $this->Password = $pass;
     // SMTP password
     $this->SMTPSecure = $smtpSecure;
     // Enable TLS encryption, `ssl` also accepted
     $this->Port = $port;
     // TCP port to connect to
     $this->isHTML($isHTML);
     // Set email format to HTML
     $this->CharSet = $charset;
 }
Пример #2
0
 public function __construct($param = false)
 {
     parent::__construct();
     if (!isset($param['type']) or isset($param['type']) && $param['type'] == 'smtp') {
         //$isSMTP 		= (!isset($param['isSMTP'])) 		? MAIL_IS_SMTP 		: $param['isSMTP'];
         $smtpAuth = !isset($param['smtpAuth']) ? MAIL_SMTP_AUTH : $param['smtpAuth'];
         $isHTML = !isset($param['isHTML']) ? MAIL_IS_HTML : $param['isHTML'];
         $charset = !isset($param['charset']) ? MAIL_CHARSET : $param['charset'];
         $smtpSecure = !isset($param['smtpSecure']) ? MAIL_SMTP_SECURE : $param['smtpSecure'];
         $host = !isset($param['host']) ? MAIL_HOST : $param['host'];
         $port = !isset($param['port']) ? MAIL_PORT : $param['port'];
         $user = !isset($param['user']) ? MAIL_USER : $param['user'];
         $pass = !isset($param['pass']) ? MAIL_PASS : $param['pass'];
         //Making an SMTP connection with authentication.
         $this->Mailer = 'smtp';
         // Set mailer to use SMTP
         $this->Host = $host;
         // Specify main and backup SMTP servers
         $this->SMTPAuth = $smtpAuth;
         // Enable SMTP authentication
         $this->Username = $user;
         // SMTP username
         $this->Password = $pass;
         // SMTP password
         $this->SMTPSecure = $smtpSecure;
         // Enable TLS encryption, `ssl` also accepted
         $this->Port = $port;
         // TCP port to connect to
         $this->isHTML($isHTML);
         // Set email format to HTML
         $this->CharSet = $charset;
     } else {
         if (isset($param['type']) && $param['type'] == 'sendmail') {
             //Sending a message using a local sendmail binary.
             $this->Mailer = 'sendmail';
         } else {
             if (isset($param['type']) && $param['type'] == 'mail' or $param['type'] == 'php') {
                 //Send messages using PHP's mail() function.
                 $this->Mailer = 'mail';
             }
         }
     }
     //Enable SMTP debugging
     // 0 = off (for production use)
     // 1 = client messages
     // 2 = client and server messages
     //$this->SMTPDebug = 2;
     //$this->Debugoutput = 'html';
 }