Index: branches/5.2.x/core/kernel/utility/email_send.php =================================================================== diff -u -N -r14244 -r14619 --- branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 14244) +++ branches/5.2.x/core/kernel/utility/email_send.php (.../email_send.php) (revision 14619) @@ -1,6 +1,6 @@ GetFilenameExtension($filename) ); + $content_type = kUtil::mimeContentTypeByExtension($filename); - $mapping = '(xls:application/excel)(hqx:application/macbinhex40)(doc,dot,wrd:application/msword)(pdf:application/pdf) - (pgp:application/pgp)(ps,eps,ai:application/postscript)(ppt:application/powerpoint)(rtf:application/rtf) - (tgz,gtar:application/x-gtar)(gz:application/x-gzip)(php,php3:application/x-httpd-php)(js:application/x-javascript) - (ppd,psd:application/x-photoshop)(swf,swc,rf:application/x-shockwave-flash)(tar:application/x-tar)(zip:application/zip) - (mid,midi,kar:audio/midi)(mp2,mp3,mpga:audio/mpeg)(ra:audio/x-realaudio)(wav:audio/wav)(bmp:image/bitmap)(bmp:image/bitmap) - (gif:image/gif)(iff:image/iff)(jb2:image/jb2)(jpg,jpe,jpeg:image/jpeg)(jpx:image/jpx)(png:image/png)(tif,tiff:image/tiff) - (wbmp:image/vnd.wap.wbmp)(xbm:image/xbm)(css:text/css)(txt:text/plain)(htm,html:text/html)(xml:text/xml) - (mpg,mpe,mpeg:video/mpeg)(qt,mov:video/quicktime)(avi:video/x-ms-video)(eml:message/rfc822)'; - - if (preg_match('/[\(,]'.$file_extension.'[,]{0,1}.*?:(.*?)\)/s', $mapping, $regs)) { - if ($file_extension == 'eml') { - $encoding = '7bit'; - } - $content_type = $regs[1]; + if ( mb_strtolower($this->GetFilenameExtension($filename)) == 'eml' ) { + $encoding = '7bit'; } - else { - $content_type = 'application/octet-stream'; - } } /** @@ -1737,25 +1722,31 @@ * * @param string $text * @param bool $multiple - * @param bool $allowOnlyDomain - * @return string + * @param bool $allow_only_domain + * @return Array|bool + * @access public */ - function ExtractRecipientEmail($text, $multiple = false, $allowOnlyDomain = false) { - if ($allowOnlyDomain) { - $pattern = '/(('.REGEX_EMAIL_USER.'@)?'.REGEX_EMAIL_DOMAIN.')/i'; - } else { - $pattern = '/('.REGEX_EMAIL_USER.'@'.REGEX_EMAIL_DOMAIN.')/i'; + public function ExtractRecipientEmail($text, $multiple = false, $allow_only_domain = false) + { + if ( $allow_only_domain ) { + $pattern = '/((' . REGEX_EMAIL_USER . '@)?' . REGEX_EMAIL_DOMAIN . ')/i'; } - if ($multiple) { - if (preg_match_all($pattern, $text, $findemail) >= 1) { - return $findemail[1]; - } else { + else { + $pattern = '/(' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . ')/i'; + } + if ( $multiple ) { + if ( preg_match_all($pattern, $text, $found_emails) >= 1 ) { + return $found_emails[1]; + } + else { return false; } - } else { - if (preg_match($pattern, $text, $findemail) == 1) { - return $findemail[1]; - } else { + } + else { + if ( preg_match($pattern, $text, $found_emails) == 1 ) { + return $found_emails[1]; + } + else { return false; } }