【问题标题】:CodeIgniter SMTP email message - characters replaced with equal signsCodeIgniter SMTP 电子邮件 - 用等号替换字符
【发布时间】:2012-10-15 11:10:52
【问题描述】:

我正在使用 CodeIgniter 电子邮件库通过我们的 Exchange 服务器发送电子邮件。我得到的问题是电子邮件的内容搞砸了。

有些词被等号“=”替换,我尝试了 2 个不同的 Exchange 服务器(它们位于不同的位置,并且没有任何关系),但我仍然遇到同样的问题。如果我使用任何其他服务器作为 SMTP 服务器来发送电子邮件,一切正常,内容保持不变。

发送前的内容:

Dear Customer

Please find attached a comprehensive explanation of how to get our brochure of Angola. This has been sent to you at the request of Alex.

The information has been taken from www.example.co.uk  "Company name" is one of the leading tile and marble companies in the UK. 

通过 Microsoft Exchange 发送后的内容:

Dear Customer

Please find attached a comprehensive explanation of how to get our brochure of A=gola. This has been sent to you at the request of Alex.

The information has been taken from www.example.co.uk  "Company name" is one of the leadi=g tile and marble companies in the UK. 

正如您所见,出于某种原因,一些“n”字符被替换为等号“=”(例如:Angola > A=gola)

我的邮箱配置:

$this->load->library('email');
$config['charset']      = 'utf-8';
$config['mailtype']     = 'html';


// SMTP
$config['protocol']     = 'smtp';
$config['smtp_host']    = 'exchange.example.com'; //ssl://
$config['smtp_user']    = 'email@example.com';
$config['smtp_pass']    = 'password';
$config['smtp_port']    = 25;

$this->email->set_newline( "\r\n" );

$this->email->initialize( $config );

$this->email->clear();

......

$this->email->from( $frome, $fromn );
$this->email->to( $email );

$this->email->subject( $subject );
$this->email->message( $send_message );


$this->email->send();

有谁知道为什么微软交易所会这样?还是我应该使用某种设置?

【问题讨论】:

    标签: php codeigniter email smtp exchange-server


    【解决方案1】:

    这很奇怪,特别是因为并非所有 ns 都被音译,而且不在特定位置。

    也尝试拨打$this->email->set_crlf( "\r\n" );。在 Exchange 中查找消息详细信息并检查 Content-Type 和 Charset / Encoding - 在此处发布原始内容以便我们进行检查。

    我在Microsoft Knowledgebase找到这个:

    Microsoft Exchange 使用增强的字符集。默认 MIME Microsoft Exchange 的字符集是 ISO 8859-1。一些网关可以 不支持此字符集为 line 发出软返回的方式 饲料。发生这种情况时,每一行都以等号结束 显示网关的行长支持结束处的换行符。

    【讨论】:

    • 非常感谢@Alix,一旦我输入 "$this->email->set_crlf( "\r\n" );"它立即工作,没有任何问题! :) 干杯!
    • 同样的问题,同样的解决方案,只是更改了 crlf,谢谢!
    • 这对我也有用,似乎 CI 2 有一个小错误,因为我在 CI 3 上有一个较新的项目,但我没有这个“错误”
    • 你拯救了我的两天,非常感谢你,这就像一个魅力!
    • 差不多五年后,它完成了这项工作。谢谢。
    【解决方案2】:

    我通过在_prep_quoted_printable 函数中设置$charlim = '998' 解决了这个问题(有点)。

    当我设置$crlf = "\r\n" 时,生成的电子邮件由于某种原因完全乱码。但我注意到 = 符号定期出现,这是由于行长限制为 76 个字符造成的。所以增加每行的最大字符数(998 是 RFC2822 的限制)可以解决问题,只要你没有很长的行。

    【讨论】:

      猜你喜欢
      • 2014-06-07
      • 2017-12-11
      • 2015-11-10
      • 2018-12-08
      • 2012-01-21
      • 2018-03-23
      • 2014-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多