PHP IMAP检索“收件人"地址中的所有收件人 [英] PHP IMAP retrieve all recipients in To address

查看:133
本文介绍了PHP IMAP检索“收件人"地址中的所有收件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PHP IMAP,我可以从gmail下载我的所有邮件附件等.但是当收件人中有多个收件人时,我只能得到一个地址.让我更清楚地解释一下.

Using PHP IMAP I am able to download all my messages attachments etc from gmail. But when there are multiple recipients in the to address I am only getting a single address. Let me explain it more clearly.

假设我有一个电子邮件地址example@gmail.com,该地址是我从中下载所有邮件的地方.现在,当test@gmail.com向我发送电子邮件时,我正在使用功能imap_headerinfo在toaddress中获得example@gmail.com.但是当test@gmail.com将邮件发送到example@gmail.com和example_1@gmail.com时,我在toaddress或Reply_toaddress或cc等中未得到此example_1@gmail.com.下面是我的消息示例输出

Suppose I have an email address example@gmail.com from where I am downloading all the messages. Now when test@gmail.com sends an email to me I am getting example@gmail.com in the toaddress using function imap_headerinfo. But when test@gmail.com sends the mail to example@gmail.com and example_1@gmail.com then I am not getting this example_1@gmail.com in toaddress or reply_toaddress or cc etc. Below is my sample output for a message

$header = imap_headerinfo($mbox, $msgno);


stdClass Object
(
  [date] => Tue, 10 Sep 2013 13:37:49 +0530
  [Date] => Tue, 10 Sep 2013 13:37:49 +0530
  [subject] => reply all test
  [Subject] => reply all test
  [message_id] => <CACYeE9OEr+9z-Q5BR69sC=nJR_qQps69-VKWxkL6j2hqKEBo2w@mail.gmail.com>
  [toaddress] => example@gmail.com
  [to] => Array
    (
        [0] => stdClass Object
            (
                [mailbox] => example
                [host] => gmail.com
            )

    )

  [fromaddress] => Test <test@gmail.com>
  [from] => Array
    (
        [0] => stdClass Object
            (
                [personal] => Test
                [mailbox] => test
                [host] => gmail.com
            )

    )

  [reply_toaddress] => Test <test@gmail.com>
  [reply_to] => Array
    (
        [0] => stdClass Object
            (
                [personal] => Test
                [mailbox] => test
                [host] => gmail.com
            )

    )

  [senderaddress] => Test <test@gmail.com>
  [sender] => Array
    (
        [0] => stdClass Object
            (
                [personal] => Test
                [mailbox] => test
                [host] => gmail.com
            )

    )

  [Recent] =>  
  [Unseen] => U
  [Flagged] =>  
  [Answered] =>  
  [Deleted] =>  
  [Draft] =>  
  [Msgno] => 34463
  [MailDate] => 10-Sep-2013 08:07:00 +0000
  [Size] => 2609
  [udate] => 1378800420
)

我希望所有收件人发邮件,以便我可以用它们回复所有人.

I want all the recipients address so that I can use them in reply all.

当我单击全部答复时,我可以在Outlook,Thunderbird等电子邮件客户端中清楚地看到所有要处理的地址(AS Cc).

I can clearly see all the to address (AS Cc) in email clients like outlook, thunderbird etc when I click on reply all.

推荐答案

终于找到了我的答案,因此想到了分享.尽管imap_headerinfo通过@Kelu的回答在To地址中给了多个收件人,但与imap_fetch_overview一起使用时,它只给出了一个地址.我使用imap_fetch_overview来获取消息号,然后使用imap_headerinfo来获取该消息的所有标题信息.这是给一个收件人地址.

Finally found my answer so thought of sharing. Though imap_headerinfo is giving multiple recipients in To address as answered by @Kelu but it was giving only a single address when used with imap_fetch_overview. I was using imap_fetch_overview to get the message number and then imap_headerinfo to get all the header information of that message. This was giving a single recipient address.

经过大量搜索后,答案仅在php.net网站上 http://www.php.net/manual/zh/function.imap-headerinfo.php#98809

After searching a lot the answer was in php.net site only http://www.php.net/manual/en/function.imap-headerinfo.php#98809

使用imap_rfc822_parse_headers和imap_fetchheader进行了测试,并且工作正常.

Tested with imap_rfc822_parse_headers and imap_fetchheader and it is working fine.

这篇关于PHP IMAP检索“收件人"地址中的所有收件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆