You are here

public function DrupalPHPMailer::SmtpSend in PHPMailer 5.2

Same name and namespace in other branches
  1. 6.3 includes/phpmailer.class.inc \DrupalPHPMailer::SmtpSend()
  2. 6.2 includes/phpmailer.class.inc \DrupalPHPMailer::SmtpSend()
  3. 7.4 includes/phpmailer.class.inc \DrupalPHPMailer::SmtpSend()
  4. 7.3 includes/phpmailer.class.inc \DrupalPHPMailer::SmtpSend()

Send mail via SMTP.

Wrapper around PHPMailer::SmtpSend() with exception handling.

Overrides PHPMailer::SmtpSend

File

includes/phpmailer.class.inc, line 54

Class

DrupalPHPMailer
Base PHPMailer for Drupal implementation with support for SMTP keep-alive and setting a custom Return-Path.

Code

public function SmtpSend($header, $body) {
  if ($this->SMTPDebug) {
    ob_start();
  }
  try {
    $result = parent::SmtpSend($header, $body);
  } catch (phpmailerException $e) {
  }
  if ($this->SMTPDebug) {
    if ($debug = ob_get_contents()) {
      drupal_set_message($debug);
    }
    ob_end_clean();
  }

  // Reinitialize properties.
  $this
    ->Reset();
  if (isset($e)) {

    // Pass exception to caller.
    throw $e;
  }
  return $result;
}