You are here

public function DrupalPHPMailer::CreateHeader in PHPMailer 5.2

Same name and namespace in other branches
  1. 6 includes/phpmailer.inc \DrupalPHPMailer::CreateHeader()
  2. 6.2 includes/phpmailer.class.inc \DrupalPHPMailer::CreateHeader()

Assemble the message header.

PHPMailer always sets Return-Path to Sender, we want more flexibility.

Overrides PHPMailer::CreateHeader

File

includes/phpmailer.class.inc, line 153

Class

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

Code

public function CreateHeader() {
  $old_sender = $this->Sender;
  if ($this->ReturnPath != '') {
    $this->Sender = $this->ReturnPath;
  }
  $result = parent::CreateHeader();

  // Restore sender for use in MAIL FROM command.
  $this->Sender = $old_sender;
  return $result;
}