You are here

public function PHPMailer::GetMailMIME in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 7.2 smtp.phpmailer.inc \PHPMailer::GetMailMIME()

Returns the message MIME. @access public

Return value

string

2 calls to PHPMailer::GetMailMIME()
PHPMailer::CreateBody in ./smtp.phpmailer.inc
Assembles the message body. Returns an empty string on failure. @access public
PHPMailer::CreateHeader in ./smtp.phpmailer.inc
Assembles message header. @access public

File

./smtp.phpmailer.inc, line 1124
The mail handler class in smtp module, based on code of the phpmailer library, customized and relicensed to GPLv2.

Class

PHPMailer
PHPMailer - PHP email transport class NOTE: Requires PHP version 5 or later @package PHPMailer @author Andy Prevost @author Marcus Bointon @copyright 2004 - 2009 Andy Prevost

Code

public function GetMailMIME() {
  $result = '';
  switch ($this->message_type) {
    case 'plain':
      $result .= $this
        ->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
      $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
      break;
    case 'attachments':
    case 'alt_attachments':
      if ($this
        ->InlineImageExists()) {
        $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
      }
      else {
        $result .= $this
          ->HeaderLine('Content-Type', 'multipart/mixed;');
        $result .= $this
          ->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
      }
      break;
    case 'alt':
      $result .= $this
        ->HeaderLine('Content-Type', 'multipart/alternative;');
      $result .= $this
        ->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
      break;
  }
  if ($this->Mailer != 'mail') {
    $result .= $this->LE . $this->LE;
  }
  return $result;
}