Email content type UTF8 not accepted
Hello everyone I have a module that sends text/html emails using the function drupal_mail(). Everything was working fine until I needed to send them in German, instead of English. I changed the email's content type header to "text/html; charset=utf-8", but the email is always sent as "text/html; charset=iso-8859-1", and the German characters are not properly shown. I tried to send it to several different mail servers (yahoo, hotmail, and others), and the result was the same. Intriguingly, when I change the content type to "text/plain; charset=utf-8", the charset is kept UTF-8, as I want, and the characters are properly shown. This problem only happens when the content type is "text/html". I also tried to set the content type header within the html code to "text/plain; charset=utf-8" too, but the problem persisted. It seems like Drupal is changing the charset to iso-8859-1. Does anyone have any idea of what is causing this problem? Cheers Diego This is my code: ... $language = user_preferred_language(); $params = array( 'subject' => t('Test'), 'body' => t($message, $variables, $language->language) ); drupal_mail('notification', 'notice', $email, $language, $params); ... function notification_mail($key, &$message, $params) { $message['headers']['Content-Type'] = "text/html; charset=utf-8"; $message['subject'] = $params['subject']; $message['body'][] = $params['body']; }
Diego G wrote:
It seems like Drupal is changing the charset to iso-8859-1.
I doubt it.
Does anyone have any idea of what is causing this problem?
Maybe your web server or php settings for html markup. Or maybe even your mail server or mail client. -- Earnie -- http://progw.com -- http://www.for-my-kids.com
Date: Mon, 16 Aug 2010 07:48:13 -0400 From: earnie@users.sourceforge.net To: development@drupal.org Subject: Re: [development] Email content type UTF8 not accepted
Diego G wrote:
It seems like Drupal is changing the charset to iso-8859-1.
I doubt it.
Does anyone have any idea of what is causing this problem?
Maybe your web server or php settings for html markup. Or maybe even your mail server or mail client.
I have tried with different servers and clients, and they all show charset iso-8859-1 in the email header. Which php settings do you mean? Where can I find it? Diego
Hi Diego - I suggest this approach: 1. Use the contact form to send an email. Does it have this problem? If not, the problem is likely not Drupal core. 2. Experiment with the Email Example in the Examples Project, http://drupal.org/project/examples. Does it have this problem? If not, imitate it. If it does, file an issue. -Randy On Mon, Aug 16, 2010 at 6:14 AM, Diego G <diegomartinsbh@hotmail.com> wrote:
Date: Mon, 16 Aug 2010 07:48:13 -0400 From: earnie@users.sourceforge.net To: development@drupal.org Subject: Re: [development] Email content type UTF8 not accepted
Diego G wrote:
It seems like Drupal is changing the charset to iso-8859-1.
I doubt it.
Does anyone have any idea of what is causing this problem?
Maybe your web server or php settings for html markup. Or maybe even your mail server or mail client.
I have tried with different servers and clients, and they all show charset iso-8859-1 in the email header.
Which php settings do you mean? Where can I find it?
Diego
-- Randy Fay Drupal Module and Site Development randy@randyfay.com +1 970.462.7450
Diego G wrote:
Date: Mon, 16 Aug 2010 07:48:13 -0400 From: earnie@users.sourceforge.net To: development@drupal.org Subject: Re: [development] Email content type UTF8 not accepted
Diego G wrote:
It seems like Drupal is changing the charset to iso-8859-1.
I doubt it.
Does anyone have any idea of what is causing this problem?
Maybe your web server or php settings for html markup. Or maybe even your mail server or mail client.
I have tried with different servers and clients, and they all show charset iso-8859-1 in the email header.
Maybe this will help: http://drupal.org/node/358855
Which php settings do you mean? Where can I find it?
Maybe none. If your client is a PHP module you might want to look at mailparse.def_charset though. -- Earnie -- http://progw.com -- http://www.for-my-kids.com
participants (3)
-
Diego G -
Earnie Boyd -
Randy Fay