PHPMailer\PHPMailer\PHPMailer::__construct PHP Method

__construct() public method

Constructor.
public __construct ( boolean $exceptions = null )
$exceptions boolean Should we throw external exceptions?
    public function __construct($exceptions = null)
    {
        if (!is_null($exceptions)) {
            $this->exceptions = (bool) $exceptions;
        }
        //Pick an appropriate debug output format automatically
        $this->Debugoutput = strpos(PHP_SAPI, 'cli') !== false ? 'echo' : 'html';
    }

Usage Example

Example #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);
     }
 }
All Usage Examples Of PHPMailer\PHPMailer\PHPMailer::__construct