__construct() public method

Constructor.
public __construct ( boolean $exceptions = null )
$exceptions boolean Should we throw external exceptions?
示例#1
2
 function __construct($fromEmail = null, $fromName = null, $replyEmail = null, $replyName = null, $host = null, $port = 25, $username = null, $password = null, $secure = null, $sendmail = null, $debug = false, $exceptions = false, $SMTPOptions = [])
 {
     parent::__construct($exceptions);
     $this->CharSet = 'UTF-8';
     $this->SMTPOptions = $SMTPOptions;
     if ($host) {
         $this->isSMTP();
         if (isset($debug)) {
             $this->SMTPDebug = $debug;
             if ($debug) {
                 $this->Debugoutput = 'html';
             }
         }
         $this->Host = $host;
         $this->Port = $port;
         if (isset($username)) {
             $this->SMTPAuth = true;
             if (isset($secure)) {
                 $this->SMTPSecure = $secure === true ? 'tls' : $secure;
             }
             $this->Username = $username;
             $this->Password = $password;
         }
     } elseif ($sendmail) {
         $this->isSendmail();
     }
     if ($fromEmail) {
         $this->setFrom($fromEmail, $fromName);
     }
     if ($replyEmail) {
         $this->addReplyTo($replyEmail, $replyName);
     }
 }
示例#2
1
 public function __construct($config, $lang_interface)
 {
     parent::__construct();
     $this->SetLanguage($lang_interface);
     $this->CharSet = $config['site_charset'];
     $mailer_mode = strtolower($config['mailer_mode']);
     if ($mailer_mode == 'smtp') {
         $this->isSMTP();
         $this->SMTPAuth = true;
         $this->Port = $config['smtp_port'];
         $this->Host = $config['smtp_host'];
         $this->Username = $config['smtp_username'];
         $this->Password = $config['smtp_password'];
         $SMTPSecure = intval($config['smtp_ssl']);
         switch ($SMTPSecure) {
             case 1:
                 $this->SMTPSecure = 'ssl';
                 break;
             case 2:
                 $this->SMTPSecure = 'tls';
                 break;
             default:
                 $this->SMTPSecure = '';
         }
     } elseif ($mailer_mode == 'sendmail') {
         $this->IsSendmail();
     } else {
         //disable_functions
         $disable_functions = (($disable_functions = ini_get('disable_functions')) != '' and $disable_functions != false) ? array_map('trim', preg_split("/[\\s,]+/", $disable_functions)) : array();
         if (extension_loaded('suhosin')) {
             $disable_functions = array_merge($disable_functions, array_map('trim', preg_split("/[\\s,]+/", ini_get('suhosin.executor.func.blacklist'))));
         }
         if (!in_array('mail', $disable_functions)) {
             $this->IsMail();
         } else {
             return false;
         }
     }
     $this->From = $config['site_email'];
     $this->FromName = $config['site_name'];
 }
示例#3
0
 public function __construct($exceptions = false)
 {
     $this->CharSet = 'UTF-8';
     $this->setFrom(\Core::$NOREPLY, \Core::$SITENAME);
     $this->addReplyTo(\Core::$NOREPLY, \Core::$SITENAME);
     return parent::__construct($exceptions);
 }
示例#4
0
 /**
  * Constructor
  *
  * @param   boolean  $exceptions  Flag if Exceptions should be thrown
  *
  * @since   11.1
  */
 public function __construct($exceptions = true)
 {
     parent::__construct($exceptions);
     // PHPMailer has an issue using the relative path for its language files
     $this->setLanguage('joomla', __DIR__ . '/language');
     // Configure a callback function to handle errors when $this->edebug() is called
     $this->Debugoutput = function ($message, $level) {
         JLog::add(sprintf('Error in JMail API: %s', $message), JLog::ERROR, 'mail');
     };
     // If debug mode is enabled then set SMTPDebug to the maximum level
     if (defined('JDEBUG') && JDEBUG) {
         $this->SMTPDebug = 4;
     }
 }