Index: branches/5.2.x/core/kernel/utility/email_send.php =================================================================== diff -u -N -r15461 -r16199 --- branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 15461) +++ branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 16199) @@ -1,6 +1,6 @@ headers[$header_name]) ) { + return array(); + } + + $decoded_header = $this->decodeHeader($this->headers[$header_name]); + $recipients = $this->GetRecipients($decoded_header); + + if ( $recipients === false ) { + return array(); + } + + return $recipients; + } + + /** + * Decodes header value. + * + * @param string $header_value Header value. + * + * @return string + */ + protected function decodeHeader($header_value) + { + while ( preg_match('/(=\?([^?]+)\?(Q|B)\?([^?]*)\?=)/i', $header_value, $matches) ) { + $encoded = $matches[1]; + $charset = $matches[2]; + $encoding = $matches[3]; + $text = $matches[4]; + + switch ( strtoupper($encoding) ) { + case 'B': + $text = base64_decode($text); + break; + + case 'Q': + $text = str_replace('_', ' ', $text); + preg_match_all('/=([a-f0-9]{2})/i', $text, $matches); + + foreach ( $matches[1] as $value ) { + $text = str_replace('=' . $value, chr(hexdec($value)), $text); + } + break; + } + + $header_value = mb_convert_encoding( + str_replace($encoded, $text, $header_value), + $this->charset, + $charset + ); + } + + return $header_value; + } + + /** * Sets "Subject" header. * * @param string $subject message subject @@ -2084,4 +2147,4 @@ { $this->_logData = $log_data; } - } \ No newline at end of file + }