Plugins & Hacks

How do I change the charset of an email sent through Nucleus?

Scenario:
"I run a Nucleus site with non-English speaking users who frequently send emails in languages that require a different charset, such as UTF-8. The emails I have been receiving so far are unreadable. Can I change the character encoding of email messages sent through the Nucleus member mail form?"

Solution:
Open /nucleus/libs/ACTION.php and find this bit of code:

      $title = _MMAIL_TITLE . ' ' . $fromName;
      mail($tomem->getEmail(), $title, $message, 'From: '. $fromMail);

Replace with this code:

      $title = _MMAIL_TITLE . ' ' . $fromName;
      mail($tomem->getEmail(), $title, $message, 'From: '. $fromMail. "\nContent-Type: text/plain; charset=XXXXX");

where XXXXX is the charset you would like to use (e.g. UTF-8, windows-1251, etc).

Original forum thread (thanks, Liandri!):
http://forum.nucleuscms.org/viewtopic.php?t=15326

section: Plugins & Hacks | submitted by Leng on 2007.Mar.22 | 1774 views

item rate
Total votes: 4 - Rating: 8.00

Please tell us how useful this answer was to you (0 = useless, 10 = very very helpful):

10