简体   繁体   中英

Message string messed up when sending email with Codeigniter email class

So I encountered a problem while making a script to send email using Codeigniter's Email class. I set the configuration like this:

    $config['protocol'] = 'mail';
    $config['charset'] = 'iso-8859-1';
    $config['wordwrap'] = FALSE;
    $config['mailtype']= "html";

The email is successfully sent, but when I open the email (the email client is a webmail client using iso-8859-1 charset) I got some of my words messed up.

Here's the email I want it to be:

Thank you for registering a UMall account. Here's the details of your account:
Email: su-mie@ntu.edu.sg
Pass: 1234567
Fullname: Reinardus Surya Pradhitya
Phone: 83612737
Click here to activate your account: http://su.ntu.edu.sg/umall/index.php/register/activate/3a228e96124a66f1070361e0961854d5

And here's how it appears:

Thank you for registering a UMall account. Here's the details of your accou= nt:
Email: su-mie@ntu.edu.sg
Pass: 1234567
Full= name: Reinardus Surya Pradhitya
Phone: 83612737
Click here= to activate your account: http://su.ntu.edu.sg/um= all/index.php/register/activate/3a228e96124a66f1070361e0961854d5

The faulty characters are always the "= ". An equal sign followed by a whitespace. Does anyone know what's wrong?

Interestingly, I tried opening it in another email client in my mobile phone, and it appears just nice.

EDIT: I think the problem is in the word wrapping. I can't override the setting and I can't use {unwrap}{/unwrap}. How to solve this?

I had the same issue and "@Alix Axel" helped to resolve it.

See this post: CodeIgniter SMTP email message - characters replaced with equal signs

It covers what configurations you need.

Try changing the charset to utf-8.

$config['protocol'] = 'mail';
$config['charset'] = 'utf-8';
$config['wordwrap'] = FALSE;
$config['mailtype']= "html";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM