Since a very significant amount of web users still use crappy mail clients or... Hotmail, it would be great to have a drop-down menu that lets the sender choose a specific character encoding.
I would like to use French characters and they look like a mess in Hotmail. (Changing the encoding to UTF-8 in IE6 makes the pages look worse and the browser unstable!)
I looked at this posting: http://drupal.org/node/73576
But couldn't work out the solution that was suggested there.
*SIGH*
So what do I do in the short term? Telling 30% of our newsletter subscribers not to use Hotmail is out of the question. Is there a bit of code somewhere that could force Simplenews to send stuff in iso-8859-1 ???
Comment | File | Size | Author |
---|---|---|---|
#13 | simplenews.module_.78876.patch | 5.6 KB | Sutharsan |
Comments
Comment #1
DriesK CreditAttribution: DriesK commentedThere was, in an earlier version of simplenews. Then, people were crying for UTF-8, and because that's the standard in Drupal, I removed the character encoding dropdown list. If I find some time, I'll reintroduce it.
Comment #2
Jonas Kvarnstrom CreditAttribution: Jonas Kvarnstrom commentedI just replaced sn_mail_send with the following. It has been tested and seems to work fine for me but I have no idea whether there might be bad side effects or other problems...
Of course, with this "fix" you can't send in UTF-8 anymore.
Comment #3
mediameriquat CreditAttribution: mediameriquat commentedGREAT!!! Thanks.
We're using French not Chinese, so we're OK with this fix. Postings look nice in Hotmail now.
Comment #4
joel_guesclin CreditAttribution: joel_guesclin commentedI have this problem also - but with a multitude of character sets, including notably Korean and Russian. What about using the multibyte_encoding functions? This would provide a wider choice than the standard PHP. A drop-down list for the site to configure in what coding the message should be sent in could be very useful.
Comment #5
Sutharsan CreditAttribution: Sutharsan commentedWe have now request of utf-8 and iso-8859-1. What encoding do you propose?
Please explain your "What about using the multibyte_encoding functions?"
Comment #6
joel_guesclin CreditAttribution: joel_guesclin commentedActually what I'm thinking of is something like this: use the multi-byte encoding functions available in PHP (though not ALWAYS available I think, so a call to function_exists would be in order no doubt) to allow the administrator to choose which encoding he wanted to use. Therefore, in the admin/settings part of Simplenews you would have a drop-down list to choose your mail encoding, which could simply be the output from mb_list_encodings.
Then the send mail function would look something like this:
Note I'm not sure this is exactly right - have not had a chance to test it yet. This would truly internationalise the simplenews function - and I could send newsletters out in Russian and Korean, not to mention not have funny characters appear in French, Portuguese, or indeed Swedish (which is not iso-8859-1 either in fact). In other words, you would be handling internationalisation correctly and as completely as possible in PHP (I think - I have to confess I'm not sure I have understood everything here...)
Comment #7
joel_guesclin CreditAttribution: joel_guesclin commentedExcept I just noticed that mb_list_encodings is PHP5 only, so you would have to do that by hand to accomodate PHP4
Comment #8
Sutharsan CreditAttribution: Sutharsan commentedFound some alternative conversion functions in the function. I post it here for future reference.
Comment #9
joel_guesclin CreditAttribution: joel_guesclin commentedSorry, you found it where? And does future reference mean it will get into Simplenews? He asked, hopefully?
Comment #10
Sutharsan CreditAttribution: Sutharsan commentedHmm, I wasn't awake this morning. The drupal_convert_to_utf8 function has two alternative conversion functions besides mb_list_encodings. Perhaps this can help in some way.
I recognize your problem because I also use those funny characters in my mails (Dutch) but the feature list is _long_ and not all can be implemented. Patches are very welcome and will help getting this functionality implemented.
Comment #11
joel_guesclin CreditAttribution: joel_guesclin commentedLooks interesting - clearly this is a way to go for a complete solution. What a shame that there is not a drupal_convert_FROM_utf8 function!
Comment #12
philippejadin CreditAttribution: philippejadin commentedI adapted the "solution" to send iso-8859-1 formated messages to hotmail email adresses only :
- download "activemaillib.php" and put it inside simplenews module folder (you have something like : drupal/modules/simplenews/activemaillib.php). I found it at http://www.phpclasses.org/browse/file/8618.html
- edit simplenews.module, around line 1188 (just before
if (module_exists('mimemail'))
insidefunction simplenews_mail_send($mail)
), and add the following :- save and "enjoy"
NOTE :
This is an ugly hack, and it uses an exernal mail lib. It is not recomended to modify a module file. But since it only affects emails ending with "hotmail.com" it should not have side effects to other emails.
Comment #13
Sutharsan CreditAttribution: Sutharsan commentedI've been working of this issue and it is not final. In fact it is waiting for further work on Mimemail.
Since there is frequent response on this issue, I decided to post it so it may help some.
This patch:
* Has one encoding selection for all e-mails send with Simplenews.
* Only works with plain text and without Mimemail module enabled.
* Is hardly tested, so at you own risk!
Comment #14
albertc CreditAttribution: albertc commentedActually, I'm having the same problem in Gmail, so it's not a Hotmail-related issue.
Is there some permanent fix available, either in Mime Mail or in Simplenews?
Comment #15
kiouv CreditAttribution: kiouv commentedSame thing here !
Comment #16
mightyiam CreditAttribution: mightyiam commentedI don't get it. Hotmail makes a mess out of UTF-8??
Comment #17
megg CreditAttribution: megg commentedthanks for the patch, but i see it is for version 1.56. i am using version 1.1 and cannot find 1.56 for download. i tried patching 1.1 but got an error "invalid foreach on line 372". what am i doing wrong?
Comment #18
megg CreditAttribution: megg commentedi ended up adding philippejadin's code instead of applying the patch. it seems to have worked fine (also using french characters), but i had to tweak two things, so i'm posting here in case it helps anyone.
in order to fix the problem for all hotmail _and_ yahoo addresses, i changed the first line:
to:
in order to display special characters correctly in the titles of my emails, i changed this:
to:
Comment #19
Jorrit CreditAttribution: Jorrit commentedUsing iso-8859-1 in an all-UTF-8 environment like Drupal is like continuing to drive with one flat tire because in a straight line that still works reasonably well. In my experience, the problem is usually Content-Transfer-Encoding, and not the Content-Type.
I had problems with UTF-8 myself, and it appeared to have been a combination of Content-Transfer-Encoding: 8bit and an outdated version of amavisd-new (an interface between an MTA and scanners such as clamav and SpamAssassin).
Drupal uses Content-Transfer-Encoding: 8bit by default. In my opinion, 8bit is the best setting, but it can cause problems with old and buggy software. SMTP originally only supported 7 bit characters, which gives a problem with UTF-8. 8 Bit has been standardized a long time ago, but as usual with these kinds of things, incompatibilities still arise now and then.
To cope with this, an additional layer of encoding was invented between the contents of the email and the MTA: the Content-Transfer-Encoding. Setting this to 8bit is the most simple way, and it expects clients and MTA's to simply interpret the text as 8 bit text. To prevent non-confirming software from messing up the mail two options are available for Content-Transfer-Encoding:
- quoted-printable. This encodes high characters using some kind of trick with = and ? signs. The resulting text is relatively readable when there are not many special characters used, hence the name. The standard PHP function is imap_8bit(), but this requires the imap extension to be available. There are native PHP replacements, of course.
- base64. Using base64 the complete text is encoded using the base64 encoding function. The downside is that the encoded text is completely unreadable. The upside is that the related PHP function (base64_encode) is part of the core and available in every PHP installation.
The point is: UTF-8 using 8bit should work, but if you want to be on the safe side, use quoted-printable. This bug is very old, and I think it was posted even before Microsoft moved to the Live platform. On the current Hotmail/Live Mail version, UTF-8/8bit is no problem anymore. Also on Outlook 2003 there is no problem.
An interesting observation is that when you send special characters using Outlook 2003, it chooses to send it using UTF-8 and quoted-printable. Perhaps a wise thing to do is just choose the way of the biggest player in the market.
The last thing I would like to say is that this problem should not be fixed in simplenews, but in Drupal itself, if it can be considered a problem at all.
Comment #20
nickdjones CreditAttribution: nickdjones commentedJust added this patch:
http://drupal.org/node/225731
And now HTML comes into hotmail, and exchange server / outlook 2007.
Some other issues have cropped up though, which we're still looking into.
Comment #21
nickdjones CreditAttribution: nickdjones commentedok, other issues were our own fault.. set to filtered html somehow. This patch looks good.
Comment #22
lelizondo CreditAttribution: lelizondo commentedpatch in #225731: Outlook 2203/2007 + filename solves this problem. the patch that worked for me was the one against 5.x-1.0 not dev, comment #2
Comment #23
joachim CreditAttribution: joachim commentedI've just had this problem reported to me by a client -- or rather #175781: HTML mail sent as attachment to hotmail but that says it's caused by hotmail not handling UTF8.
What's the status of this issue?
Is the most recent thing the patch in #13? Which version was that against?
Comment #24
Sutharsan CreditAttribution: Sutharsan commentedThe patch is quite old (april 2007). Feel free to re-roll for the current head.
Comment #25
andrenoronha CreditAttribution: andrenoronha commentedsubscribing
Comment #26
andrenoronha CreditAttribution: andrenoronha commentedI saw lots of solutions...but which one is currently more up to date? which one works fine for 6 version??
Comment #27
andrenoronha CreditAttribution: andrenoronha commented#12 didnt work for me...
the emails are been received in attatched files for hotmail.
[editing]
it works if I test only with a single email from hotmail...
Comment #28
andrenoronha CreditAttribution: andrenoronha commentedi got the solution here
http://drupal.org/node/741984
Comment #29
Simon Georges CreditAttribution: Simon Georges commentedAt this point, this issue is going to be marked as won't fix.
Both Simplenews & Mimemail have had new versions since then, so please create a new issue if you still have a problem and the solution provided by #741984: Problem with HTML Newsletter is not sufficient.
Comment #30
sgurlt CreditAttribution: sgurlt commentedCould someone please tell me where i could find this function? and if i use the patch at #6, will iso 8859 been corretly displayed in html mails?
Comment #31
sgurlt CreditAttribution: sgurlt commentedComment #32
BerdirYou can't find it, that function doesn't exist. This issue has been closed more than a year ago. If you have issues, open a new one.