public function PHPMailer::EncodeString in SMTP Authentication Support 7.2
Same name and namespace in other branches
- 5 smtp.module \PHPMailer::EncodeString()
- 7 smtp.phpmailer.inc \PHPMailer::EncodeString()
Encodes string to requested format. Returns an empty string on failure.
@access public
Parameters
string $str The text to encode:
string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable':
Return value
string
3 calls to PHPMailer::EncodeString()
- PHPMailer::AttachAll in ./
smtp.phpmailer.inc - Attaches all fs, string, and binary attachments to the message. Returns an empty string on failure. @access private
- PHPMailer::CreateBody in ./
smtp.phpmailer.inc - Assembles the message body. Returns an empty string on failure. @access public
- PHPMailer::EncodeFile in ./
smtp.phpmailer.inc - Encodes attachment in requested format. Returns an empty string on failure.
File
- ./
smtp.phpmailer.inc, line 1479 - 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 EncodeString($str, $encoding = 'base64') {
$encoded = '';
switch (strtolower($encoding)) {
case 'base64':
$encoded = chunk_split(base64_encode($str), 76, $this->LE);
break;
case '7bit':
case '8bit':
$encoded = $this
->FixEOL($str);
//Make sure it ends with a line break
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(t('Unknown encoding: !enc', array(
'!enc' => $encoding,
)));
break;
}
return $encoded;
}