You are here

function MimeMailPHPMailer::MimeMailPHPMailer in PHPMailer 5

Same name and namespace in other branches
  1. 6 includes/mimemail.inc \MimeMailPHPMailer::MimeMailPHPMailer()

Constructor.

File

includes/mimemail.inc, line 9

Class

MimeMailPHPMailer

Code

function MimeMailPHPMailer() {
  $this
    ->IsSMTP();

  // Assemble host name(s).
  $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 = $this->Username != '' && $this->Password != '';

  // Set default From name.
  $from_name = variable_get('smtp_fromname', '');
  if ($from_name == '') {

    // Fall back on site name.
    $from_name = variable_get('site_name', 'Drupal');
  }
  $this->FromName = $from_name;
  $this->SMTPKeepAlive = variable_get('smtp_keepalive', 0);
  $this->SMTPDebug = variable_get('smtp_debug', 0);
  $this->CharSet = variable_get('smtp_charset', 'utf-8');

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