Modified: pear/packages/Mail_Mime/trunk/mime.php =================================================================== --- pear/packages/Mail_Mime/trunk/mime.php 2009-12-30 10:38:14 UTC (rev 292793) +++ pear/packages/Mail_Mime/trunk/mime.php 2009-12-30 11:39:59 UTC (rev 292794) @@ -170,23 +170,51 @@ /** * Constructor function. * - * @param string $crlf what type of linebreak to use. Defaults to "\r\n" + * @param mixed $params Build parameters that change the way the email + * is built. Should be associative. Can contain: + * head_encoding - What encoding to use for the headers. + * Options: quoted-printable or base64 + * Default is quoted-printable + * text_encoding - What encoding to use for plain text + * Options: 7bit, 8bit, base64, or quoted-printable + * Default is 7bit + * html_encoding - What encoding to use for html + * Options: 7bit, 8bit, base64, or quoted-printable + * Default is quoted-printable + * html_charset - The character set to use for html. + * Default is iso-8859-1 + * text_charset - The character set to use for text. + * Default is iso-8859-1 + * head_charset - The character set to use for headers. + * Default is iso-8859-1 + * eof - Type of linebreak to use. Default is "\r\n" * * @return void - * * @access public */ - function Mail_mime($crlf = "\r\n") + function Mail_mime($params = array()) { - $this->_setEOL($crlf); $this->_build_params = array( - 'head_encoding' => 'quoted-printable', - 'text_encoding' => '7bit', - 'html_encoding' => 'quoted-printable', - 'html_charset' => 'ISO-8859-1', - 'text_charset' => 'ISO-8859-1', - 'head_charset' => 'ISO-8859-1' - ); + 'head_encoding' => 'quoted-printable', + 'text_encoding' => '7bit', + 'html_encoding' => 'quoted-printable', + 'html_charset' => 'ISO-8859-1', + 'text_charset' => 'ISO-8859-1', + 'head_charset' => 'ISO-8859-1', + 'eof' => "\r\n" + ); + + // Backward-compat. + if (is_string($params)) + $params = array('eof' => $params); + + if (!empty($params) && is_array($params)) { + while (list($key, $value) = each($params)) { + $this->_build_params[$key] = $value; + } + } + + $this->_setEOL($this->_build_params['eof']); } /** @@ -200,8 +228,98 @@ $this->_setEOL($this->_eol); } + /** + * Set encoding to use for the headers + * + * @param string $head_encoding Encoding to use for the headers. + * Options: quoted-printable or base64 + * + * @return void + * @access public + */ + function setHeadEncoding($head_encoding) { + $this->_build_params['head_encoding'] = $head_encoding; + } /** + * Set encoding to use for plain text message part + * + * @param string $text_encoding Encoding to use for plain text. + * Options: 7bit, 8bit, base64, quoted-printable + * + * @return void + * @access public + */ + function setTextEncoding($text_encoding) { + $this->_build_params['text_encoding'] = $text_encoding; + } + + /** + * Set encoding to use for html message part + * + * @param string $html_encoding Encoding to use for html + * Options: 7bit, 8bit, base64, quoted-printable + * + * @return void + * @access public + */ + function setHtmlEncoding($html_encoding) { + $this->_build_params['html_encoding'] = $html_encoding; + } + + /** + * Set the character set to use for html message part + * + * @param string $html_charset The character set to use for html + * + * @return void + * @access public + */ + function setHtmlCharset($html_charset) { + $this->_build_params['html_charset'] = $html_charset; + } + + /** + * Set the character set to use for plain text message part + * + * @param string $text_charset The character set to use for text + * + * @return void + * @access public + */ + function setTextCharset($text_charset) { + $this->_build_params['text_charset'] = $text_charset; + } + + /** + * Set the character set to use for headers + * + * @param string $head_charset The character set to use for headers + * + * @return void + * @access public + */ + function setHeadCharset($head_charset) { + $this->_build_params['head_charset'] = $head_charset; + } + + /** + * Set the object's end-of-line and define the constant if applicable. + * + * @param string $eol End Of Line sequence + * + * @return void + * @access private + */ + function _setEOL($eol) + { + $this->_eol = $eol; + if (!defined('MAIL_MIME_CRLF')) { + define('MAIL_MIME_CRLF', $this->_eol, true); + } + } + + /** * Accessor function to set the body text. Body text is used if * it's not an html mail being sent or else is used to fill the * text/plain part that emails clients who don't support @@ -1211,22 +1329,6 @@ } /** - * Set the object's end-of-line and define the constant if applicable. - * - * @param string $eol End Of Line sequence - * - * @return void - * @access private - */ - function _setEOL($eol) - { - $this->_eol = $eol; - if (!defined('MAIL_MIME_CRLF')) { - define('MAIL_MIME_CRLF', $this->_eol, true); - } - } - - /** * Get file's basename (locale independent) * * @param string $filename Filename Modified: pear/packages/Mail_Mime/trunk/package.xml =================================================================== --- pear/packages/Mail_Mime/trunk/package.xml 2009-12-30 10:38:14 UTC (rev 292793) +++ pear/packages/Mail_Mime/trunk/package.xml 2009-12-30 11:39:59 UTC (rev 292794) @@ -28,36 +28,19 @@ yes - 2009-12-29 + ? - 1.5.3 - 1.3.2 + 1.6.0rc1 + 1.4.0 - stable + beta stable BSD Style -Fixed bugs: - * Fix Bug #14678: srand() lowers security [clockwerx] - * Fix Bug #12921: _file2str not binary safe [walter] - * Fix Bug #12385: Bad regex when replacing css style attachments [cipri] - * Fix Bug #16911: Excessive semicolon in MIME header [alec] - * Fix Bug #15320: Attachment charset is not set in Content-Type header [alec] - * Fix Bug #16911: Lack of semicolon separator for MIME header parameters [alec] - * Fix Bug #16846: Use preg_replace_callback() instead of /e modifier [alec] - * Fix Bug #14779: Problem with an empty attachment [alec] - * Fix Bug #15913: Optimize the memory used by Mail_mimePart::encode. - Avoid having attachments data duplicated in memory [alec] - * Fix Bug #16539: Headers longer than 998 characters aren't wrapped [alec] - * Fix Bug #11238: Wrong encoding of structured headers [alec] - * Fix Bug #13641: iconv_mime_encode() seems to work different/errorious than - the build in logic. Removed 'ignore_iconv' param. [alec] - * Fix Bug #16706: Incorrect double-quotes RFC 2231-encoded parameter values [alec] - * Fix Bug #14232: RFC2231: tspecials encoding in _buildHeaderParam() [alec] Implemented Features: - * Implement Feature #10438: Function (encodeHeader) for encoding of given header [alec] + * Feature #10884: Provide easy way to set build params [alec] @@ -467,5 +450,38 @@ * Fix Bug #11381: domain name is attached to content-id, trailing greater-than sign is not remove [cipri] + + + 1.5.3 + 1.3.2 + + + stable + stable + + 2009-12-29 + BSD Style + +Fixed bugs: + * Fix Bug #14678: srand() lowers security [clockwerx] + * Fix Bug #12921: _file2str not binary safe [walter] + * Fix Bug #12385: Bad regex when replacing css style attachments [cipri] + * Fix Bug #16911: Excessive semicolon in MIME header [alec] + * Fix Bug #15320: Attachment charset is not set in Content-Type header [alec] + * Fix Bug #16911: Lack of semicolon separator for MIME header parameters [alec] + * Fix Bug #16846: Use preg_replace_callback() instead of /e modifier [alec] + * Fix Bug #14779: Problem with an empty attachment [alec] + * Fix Bug #15913: Optimize the memory used by Mail_mimePart::encode. + Avoid having attachments data duplicated in memory [alec] + * Fix Bug #16539: Headers longer than 998 characters aren't wrapped [alec] + * Fix Bug #11238: Wrong encoding of structured headers [alec] + * Fix Bug #13641: iconv_mime_encode() seems to work different/errorious than + the build in logic. Removed 'ignore_iconv' param. [alec] + * Fix Bug #16706: Incorrect double-quotes RFC 2231-encoded parameter values [alec] + * Fix Bug #14232: RFC2231: tspecials encoding in _buildHeaderParam() [alec] +Implemented Features: + * Implement Feature #10438: Function (encodeHeader) for encoding of given header [alec] + +