【问题标题】:Get 'To' field value from imap_headerinfo function or imap_search function从 imap_headerinfo 函数或 imap_search 函数获取 'To' 字段值
【发布时间】:2014-03-25 07:33:30
【问题描述】:

我有以下代码从“To”获取值,但输出是 Array

$header=imap_headerinfo($inbox,'18');
echo $header->to;

第二 我使用 imap_search 函数搜索电子邮件并在电子邮件正文中找到所需的字符串。现在一些电子邮件客户端确实使用不同的正文,所以让我们说雅虎。 Outlook 或任何其他客户端中的实际电子邮件如下所示:

The mail system

<dkkfdjhfhjd@gmail.com>: host gmail-smtp-in.l.google.com[173.194.77.26] said:
550-5.1.1 The email account that you tried to reach does not exist. Please
try 550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1
http://support.google.com/mail/bin/answer.py?answer=6596
c10si1356788oed.181 - gsmtp (in reply to RCPT TO command)

但是当我尝试通过以下方式打印它时:

$message = imap_fetchbody($inbox,'18',1);
echo $message;

打印如下:

The mail system : host gmail-smtp-in.l.google.com[173.194.77.26] said: 550-5.1.1
The email account that you tried to reach does not exist. Please try 550-5.1.1 
double-checking the recipient's email address for typos or 550-5.1.1 unnecessary 
spaces. Learn more at 550 5.1.1 http://support.google.com/mail/bin/answer.py?
answer=6596c10si1356788oed.181 - gsmtp (in reply to RCPT TO command)

我也无法从中获取电子邮件地址。 谁能告诉体面的方法来获取交付失败的用户的电子邮件地址?从标题或其他什么?我非常需要它,有人可以帮忙吗?

【问题讨论】:

    标签: php email imap


    【解决方案1】:

    你得到的数组是一个地址数组。

    获取失败地址的最佳方法是查看正文部分,找到内容类型为message/delivery-status 的部分,然后对其进行解析。

    【讨论】:

    • 是的,但是正文部分不包含此类信息,您能举一个例子吗?
    • 点击链接;第 33 至 36 页是示例。 (第 37 页的示例与您无关。)
    • 我了解内容,但如何从中解析出电子邮件地址?我对这些东西不太熟悉,无法收集太多信息。
    • 如果您能帮我解决这个问题,那将非常有帮助,请提供一些详细的见解如何实现它。
    • 我认为我的“详细见解”是指 PHP 代码。抱歉,我无法提供。我可以回答电子邮件和 imap 问题。
    猜你喜欢
    • 1970-01-01
    • 2014-12-12
    • 1970-01-01
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 2013-10-10
    • 2023-03-18
    • 2014-09-25
    相关资源
    最近更新 更多