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

标签 php codeigniter html-email

我的电子邮件有问题,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.

每张图片和链接甚至文字都被破坏了 我在想它与{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';

这是 Controller

 $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, $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 = '200';
    }

关于php - codeigniter html电子邮件更改字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14916834/

相关文章:

javascript - Chart.js 从 PHP 加载数据颜色

php - Codeigniter 扩展 native 库

php - 使用 join codeigniter 进行求和查询

php - Codeigniter redirect() 和 header

iphone - 停止 iPhone 调整 HTML 电子邮件大小的问题

HTML Outlook 电子邮件中的 CSS 表格列自动宽度

css - 编码 HTML 电子邮件 - 添加图像轮廓/边框 - gmail 和 Outlook

php - 将 PHP 脚本转换为独立的 Windows 可执行文件

php - 使用 wp_redirect 重定向 wordpress 页面

php - MySQLi - 试图获取非对象的属性