You are here

function PHPMailer::EncodeString in SMTP Authentication Support 5

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

Encodes string to requested format. Returns an empty string on failure. @access private

Return value

string

3 calls to PHPMailer::EncodeString()
PHPMailer::AttachAll in ./smtp.module
Attaches all fs, string, and binary attachments to the message. Returns an empty string on failure. @access private
PHPMailer::CreateBody in ./smtp.module
Assembles the message body. Returns an empty string on failure. @access private
PHPMailer::EncodeFile in ./smtp.module
Encodes attachment in requested format. Returns an empty string on failure. @access private

File

./smtp.module, line 1580
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 EncodeString($str, $encoding = "base64") {
  $encoded = "";
  switch (strtolower($encoding)) {
    case "base64":

      // chunk_split is found in PHP >= 3.0.6
      $encoded = chunk_split(base64_encode($str), 76, $this->LE);
      break;
    case "7bit":
    case "8bit":
      $encoded = $this
        ->FixEOL($str);
      if (substr($encoded, -strlen($this->LE)) != $this->LE) {
        $encoded .= $this->LE;
      }
      break;
    case "binary":
      $encoded = $str;
      break;
    case "quoted-printable":
      $encoded = $this
        ->EncodeQP($str);
      break;
    default:
      $this
        ->SetError($this
        ->Lang("encoding") . $encoding);
      break;
  }
  return $encoded;
}