在Zend Framework中,magento/lib/Zend/Mime.php
实现,const LINELENGTH = 72;
但常量被覆盖app/code/core/Zend/Mime.php
并设置为200。您可以app/code/core/Zend/Mime.php
使用Magento的常规机制覆盖并更改encode
方法的实现,将self :: LINELENGTH替换为其他常量:
public static function encode($str, $encoding, $EOL = self::LINEEND)
{
switch ($encoding) {
case self::ENCODING_BASE64:
// original: return self::encodeBase64($str, self::LINELENGTH, $EOL);
return self::encodeBase64($str, 72, $EOL); // hardcoded value, just to emphasize the meaning
case self::ENCODING_QUOTEDPRINTABLE:
return self::encodeQuotedPrintable($str, self::LINELENGTH, $EOL);
default:
/**
* @todo 7Bit and 8Bit is currently handled the same way.
*/
return $str;
}
}
/编辑:最初,我用Zend_Mime :: LINELENGTH替换了self :: LINELENGTH; 这是行不通的,因为自动加载器将始终从Magento内核而不是lib / Zend加载Zend_Mime类。