You are here

function DrupalPHPMailer::DrupalPHPMailer in PHPMailer 6

Same name and namespace in other branches
  1. 5 includes/phpmailer.inc \DrupalPHPMailer::DrupalPHPMailer()

Constructor.

File

includes/phpmailer.inc, line 19

Class

DrupalPHPMailer

Code

function DrupalPHPMailer() {
  $this
    ->IsSMTP();
  $this
    ->Reset();
  $protocol = variable_get('smtp_protocol', '');
  $this->Host = $protocol . variable_get('smtp_host', '');
  if ($backup = variable_get('smtp_hostbackup', '')) {
    $this->Host .= ';' . $protocol . $backup;
  }
  $this->Port = variable_get('smtp_port', '25');

  // Use SMTP authentication if both username and password are given.
  $this->Username = variable_get('smtp_username', '');
  $this->Password = variable_get('smtp_password', '');
  $this->SMTPAuth = (bool) ($this->Username != '' && $this->Password != '');
  $this->SMTPKeepAlive = variable_get('smtp_keepalive', 0);
  $this->SMTPDebug = variable_get('smtp_debug', 0);

  // Adjust path to SMTP class.
  $this->PluginDir = drupal_get_path('module', 'phpmailer') . '/phpmailer/';
}