You are here

function PHPMailer::EncodeQP in SMTP Authentication Support 5

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

Encode string to quoted-printable. @access private

Return value

string

1 call to PHPMailer::EncodeQP()
PHPMailer::EncodeString in ./smtp.module
Encodes string to requested format. Returns an empty string on failure. @access private

File

./smtp.module, line 1664
Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.

Class

PHPMailer
PHPMailer - PHP email transport class @package PHPMailer @author Brent R. Matzelle @copyright 2001 - 2003 Brent R. Matzelle

Code

function EncodeQP($str) {
  $encoded = $this
    ->FixEOL($str);
  if (substr($encoded, -strlen($this->LE)) != $this->LE) {
    $encoded .= $this->LE;
  }

  // Replace every high ascii, control and = characters
  $encoded = preg_replace('/([\\000-\\010\\013\\014\\016-\\037\\075\\177-\\377])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded);

  // Replace every spaces and tabs when it's the last character on a line
  $encoded = preg_replace("/([\t ])" . $this->LE . "/e", "'='.sprintf('%02X', ord('\\1')).'" . $this->LE . "'", $encoded);

  // Maximum line length of 76 characters before CRLF (74 + space + '=')
  $encoded = $this
    ->WrapText($encoded, 74, true);
  return $encoded;
}