PHPMailer\PHPMailer

PHPMailer::getMailMIME()publicWP 1.0

Get the message MIME type headers.

Method of the class: PHPMailer{}

No Hooks.

Return

String.

Usage

$PHPMailer = new PHPMailer();
$PHPMailer->getMailMIME();

PHPMailer::getMailMIME() code WP 6.4.3

public function getMailMIME()
{
    $result = '';
    $ismultipart = true;
    switch ($this->message_type) {
        case 'inline':
            $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
            $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
            break;
        case 'attach':
        case 'inline_attach':
        case 'alt_attach':
        case 'alt_inline_attach':
            $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_MIXED . ';');
            $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
            break;
        case 'alt':
        case 'alt_inline':
            $result .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
            $result .= $this->textLine(' boundary="' . $this->boundary[1] . '"');
            break;
        default:
            //Catches case 'plain': and case '':
            $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
            $ismultipart = false;
            break;
    }
    //RFC1341 part 5 says 7bit is assumed if not specified
    if (static::ENCODING_7BIT !== $this->Encoding) {
        //RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
        if ($ismultipart) {
            if (static::ENCODING_8BIT === $this->Encoding) {
                $result .= $this->headerLine('Content-Transfer-Encoding', static::ENCODING_8BIT);
            }
            //The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
        } else {
            $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
        }
    }

    return $result;
}