diff options
author | momo-i <momo-i@ampache> | 2008-08-25 23:03:07 +0000 |
---|---|---|
committer | momo-i <momo-i@ampache> | 2008-08-25 23:03:07 +0000 |
commit | 409ece91cc8fa1cb734c4b9754cbe7035cfc6643 (patch) | |
tree | 4f6b6375f3ea75cd99e0757fe7e95321f1f8f197 /admin | |
parent | bfc0647117c23618952f27c7af843ce6666fa3f4 (diff) | |
download | ampache-409ece91cc8fa1cb734c4b9754cbe7035cfc6643.tar.gz ampache-409ece91cc8fa1cb734c4b9754cbe7035cfc6643.tar.bz2 ampache-409ece91cc8fa1cb734c4b9754cbe7035cfc6643.zip |
fix multibyte character email
Diffstat (limited to 'admin')
-rw-r--r-- | admin/mail.php | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/admin/mail.php b/admin/mail.php index e2afcda9..8650b468 100644 --- a/admin/mail.php +++ b/admin/mail.php @@ -36,10 +36,20 @@ switch ($_REQUEST['action']) { exit; } + // Multi-byte Character Mail + if(function_exists('mb_language')) { + ini_set("mbstring.internal_encoding","UTF-8"); + mb_language("uni"); + } + $clients = AmpacheMail::get_users($_REQUEST['to']); foreach ($clients as $client) { - $recipient .= $client['fullname'] ." <" . $client['email'] . ">, "; + if(function_exists('mb_encode_mimeheader')) { + $recipient .= mb_encode_mimeheader($client['fullname']) ." <" . $client['email'] . ">, "; + } else { + $recipient .= $client['fullname'] ." <" . $client['email'] . ">, "; + } } // Remove the last , from the recipient @@ -47,9 +57,32 @@ switch ($_REQUEST['action']) { // Set the vars on the object AmpacheMail::$recipient = $recipient; - AmpacheMail::$from = $GLOBALS['user']->fullname."<".$GLOBALS['user']->email.">"; - AmpacheMail::$subject = scrub_in($_REQUEST['subject']); - AmpacheMail::$message = scrub_in($_REQUEST['message']); + if(function_exists('mb_encode_mimeheader')) { + $fullname = mb_encode_mimeheader($GLOBALS['user']->fullname); + } else { + $fullname = $GLOBALS['user']->fullname; + } + AmpacheMail::$to = $fullname . "<" . $GLOBALS['user']->email . ">"; + AmpacheMail::$from = $fullname . "<" . $GLOBALS['user']->email . ">"; + AmpacheMail::$subject = scrub_in($_REQUEST['subject']); + if(function_exists('mb_eregi_replace')) { + AmpacheMail::$message = mb_eregi_replace("\r\n", "\n", scrub_in($_REQUEST['message'])); + } else { + AmpacheMail::$message = scrub_in($_REQUEST['message']); + } + AmpacheMail::$additional_header = array(); + AmpacheMail::$additional_header[] = 'X-Ampache-Mailer: 0.0.1'; + if(function_exists('mb_send_mail')) { + AmpacheMail::$additional_header[] = 'Content-Type: text/plain; charset=UTF-8'; + AmpacheMail::$additional_header[] = 'Content-Transfer-Encoding: 8bit'; + } else { + AmpacheMail::$additional_header[] = 'Content-Type: text/plain; charset=us-ascii'; + AmpacheMail::$additional_header[] = 'Content-Transfer-Encoding: 7bit'; + } + AmpacheMail::$additional_header[] = "From: " . AmpacheMail::$from; + AmpacheMail::$additional_header[] = "Bcc: $recipient"; + AmpacheMail::$sender = $GLOBALS['user']->email; + AmpacheMail::send(); /* Confirmation Send */ |