You are here

public function DrupalPHPMailer::CreateHeader in PHPMailer 6.2

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

Assemble the message header.

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

File

includes/phpmailer.class.inc, line 161

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;
}