微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – codeigniter html电子邮件更改字符

我有电子邮件的问题,html是好的,但是当我打开它们时,文本中的错误链接中的一些字符变为= =

Thanks for joining . your log=n details are here ma=e sure you keep them safe.
To verify your email address,please follow this link:

 Finish your registration...

Link doesn't work? copy the following link to your browser address bar:  http://www.myurl.com/dev=l/panel/auth/activate/123131/123131

Please verify your email within 123131 hours,otherwise your registration =ill become invalid and you will have to register again.

每个图像和链接甚至文本都是borken
我认为它与{unwrap}有一些关系,但没有帮助

这是config / email.PHP

$config['email_notification']['protocol'] = 'smtp';
$config['email_notification']['smtp_host'] = 'smtp.live.com';
$config['email_notification']['smtp_user'] = 'xxxxx';
$config['email_notification']['smtp_pass'] = 'xxxxxxx';
$config['email_notification']['smtp_port'] = '587';
$config['email_notification']['mailtype'] = 'html';
$config['email_notification']['charset'] = 'utf-8';
$config['email_notification']['wordwrap'] = false;
$config['email_notification']['smtp_crypto'] = 'tls';

这是控制器

$this->load->library('email');



    $this->email->initialize($this->config->item('email_notification'));
    $this->email->subject('Email Test');

    $this->email->set_newline("\r\n");
    $this->email->from('xxxxxx'); // change it to yours
    $this->email->to('xxxxx');
    $this->email->subject('Email Test');

    $data=array(
        'site_name'=>'tralalalal','user_id'=>'123131','new_email_key'=>'123131','activation_period'=>'123131','email'=>'123131','title'=>'123131',);
    $this->email->message($this->load->view('email/activate_account/en',$data,true));

电子邮件正文

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
    /* Client-specific Styles */
#outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
body{-webkit-text-size-adjust:none;} /* Prevent Webkit platforms from changing default text sizes. */

    /* Reset Styles */
body{margin:0; padding:0;}
img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
table td{border-collapse:collapse;}
#backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}
</style>
</head>
<body>

谢谢

解决方法

我找到了答案,所以如果有人有同样的问题

这就是为什么

There are two limits that this standard places on the number of
characters in a line. Each line of characters MUST be no more than
998 characters,and SHOULD be no more than 78 characters,excluding
the CRLF.

The 998 character limit is due to limitations in many
implementations which send,receive,or store Internet Message
Format messages that simply cannot handle more than 998 characters
on a line. Receiving implementations would do well to handle an
arbitrarily large number of characters in a line for robustness
sake. However,there are so many implementations which (in
compliance with the transport requirements of [RFC2821]) do not
accept messages containing more than 1000 character including the
CR and LF per line,it is important for implementations not to
create such messages.

The more conservative 78 character recommendation is to accommodate
the many implementations of user interfaces that display these
messages which may truncate,or disastrously wrap,the display of
more than 78 characters per line,in spite of the fact that such
implementations are non-conformant to the intent of this
specification (and that of [RFC2821] if they actually cause
information to be lost). Again,even though this limitation is put on
messages,it is encumbant upon implementations which display messages

这是您更改代码以覆盖此限制的位置
系统/库/ email.PHP

原单

protected function _prep_quoted_printable($str,$charlim = '')
{
    // Set the character limit
    // Don't allow over 76,as that will make servers and MUAs barf
    // all over quoted-printable data
    if ($charlim == '' OR $charlim > '76')
    {
        $charlim = '76';
    }

快速解决 :)

protected function _prep_quoted_printable($str,as that will make servers and MUAs barf
    // all over quoted-printable data
    if ($charlim == '' OR $charlim > '76')
    {
        $charlim = '200';
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐