【问题标题】:php imap email body readingphp imap 电子邮件正文阅读
【发布时间】:2012-06-27 12:19:25
【问题描述】:

我正在通过 imap 收到我的电子邮件,但在我的收件箱中收到一封包含字母 Â 的电子邮件,而 imap 不会收到它的正文。其余的电子邮件可以正常阅读。它的标题很好,它会读取。

我怎样才能得到带有这种信件的电子邮件正文

代码示例在这里

$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to mail server: ' . imap_last_error());
$emails = imap_search($inbox,'SUBJECT "UKPF - New Booking"'); 
$overview = imap_fetch_overview($inbox,$email_number,0);
$message  = imap_fetchbody($inbox,$email_number,2);

【问题讨论】:

  • 我还注意到它不会从特定电子邮件地址读取电子邮件正文。 imap 应该发生这种情况吗?

标签: php special-characters imap


【解决方案1】:

我曾经在我的 php 表单中遇到某些字符的问题,这有帮助:

我把这个

"MIME-Version: 1.0; Content-Type: text/plain; charset=utf-8"

在mail() 参数中。我不知道 imap 是什么或它的工作原理有何不同,但希望这会有所帮助。

【讨论】:

    【解决方案2】:

    我已经使用这个引用的可打印解码 php 函数解决了这个问题。在你的情况下:

    $message = quoted_printable_decode($imap_fetchbody($inbox,$email_number,2));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多