Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

UTF-8 support in TWG email messages
https://www.tinywebgallery.com/forum/viewtopic.php?f=5&t=2292
Page 1 of 1

Author:  Maskolis [ 8. Dec 2009, 18:36 ]
Post subject:  UTF-8 support in TWG email messages

I've entered some Lithuanian translation... And couldn't see characters correctly in email messages (TWG v1.7.8.1).
Not sure whether it can be called as bug, or feature request :)
But as this gallery can be pretty well localized - I assume this feature is a must :)

Editing two files solved my problems (user registering email for notifications and admin sending those notifications). I haven't tried selfregistration module yet.

i_email_user.php (ln93):
change
Code:
        if ($enable_email_sending) {
            if (!@mail ($email, html_entity_decode ($lang_email_subscribemail_subject), html_entity_decode (str_replace("\n", "\r\n", $lang_email_subscribemail)), $submailheaders)) {
                $localmessage = $lang_email_error_send_mail;
to:
Code:
        if ($enable_email_sending) {
            if (!@mail ($email, '=?UTF-8?B?'.base64_encode(html_entity_decode($lang_email_subscribemail_subject)).'?=', html_entity_decode(str_replace("\n", "\r\n", $lang_email_subscribemail)), $submailheaders.'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n")) {
                $localmessage = $lang_email_error_send_mail;
In particular - the following code added:
if (!@mail ($email, '=?UTF-8?B?'.base64_encode(html_entity_decode($lang_email_subscribemail_subject)).'?=', html_entity_decode(str_replace("\n", "\r\n", $lang_email_subscribemail)), $submailheaders.'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n"))

email_admin.php (ln161):
change
Code:
          if ($enable_email_sending) {
            mail ($l, $subject, str_replace("\n", "\r\n", $message . $end), $mailheaders);
          }
to:
Code:
          if ($enable_email_sending) {
            mail ($l, '=?UTF-8?B?'.base64_encode($subject).'?=', str_replace("\n", "\r\n", $message . $end), $mailheaders.'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n");
          }
In particular - the following code added:
if ($enable_email_sending) {
mail ($l, '=?UTF-8?B?'.base64_encode($subject).'?=', str_replace("\n", "\r\n", $message . $end), $mailheaders.'MIME-Version: 1.0' . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n");


Tested Lithuanian characters (ĄąČ莞...) and Russian cyrilic (АаБбВвГгДд...) in both - subject and body. Seems to be OK for mail programs and providers I use :)

Author:  TinyWebGallery [ 8. Dec 2009, 18:42 ]
Post subject: 

You are right - The current implementation was not sending utf-8 e-mails.

I will add this to 1.8.

- Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/