SSilence / php-imap-client

a easy solution for simple IMAP email access in php
MIT License
269 stars 136 forks source link

Only one recipients visible in TO header #185

Open TrueShutDown opened 7 years ago

TrueShutDown commented 7 years ago

Headers CC, BCC are correctly, but TO header include only one recipients

This is part of header message and dump IncomingMessage object

BCC: bcc1@example1.pl, bcc2@example1.pl From: AppTest test@example.com Subject: =?UTF-8?B?dW5pdF90ZXN0X3NlbmQxX8SZxJjDs8OTxIXEhMWbxZrFgsWBxbzFu8W6?= =?UTF-8?B?xbnEh8SGxYTFgw==?= To: example1 abc@example1.pl, test@example2.pl Cc: cc1@example1.pl, cc2@example1.pl Reply-To: reply1@example1.pl, reply2@example1.pl Message-ID: e4bd310c-9b65-c8b6-adb5-d4c4426002fb@gmail.com Date: Thu, 6 Apr 2017 00:37:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------317B09975AAF7083304CA518"

This is a multi-part message in MIME format. --------------317B09975AAF7083304CA518

SSilence\ImapClient\IncomingMessage Object
(
    [header] => stdClass Object
        (
            [subject] => unit_test_send1_ęĘóÓąĄśŚłŁżŻźŹćĆńŃ
            [from] => AppTest <test@example.com>
            [to] => example1 <abc@example1.pl>
            [date] => Thu, 6 Apr 2017 00:37:21 +0200
            [message_id] => <e4bd310c-9b65-c8b6-adb5-d4c4426002fb@gmail.com>
            [size] => 5546
            [uid] => 45
            [msgno] => 1
            [recent] => 0
            [flagged] => 0
            [answered] => 0
            [deleted] => 0
            [seen] => 1
            [draft] => 0
            [udate] => 1491431842
            [details] => stdClass Object
                (
                    [date] => Thu, 6 Apr 2017 00:37:21 +0200
                    [Date] => Thu, 6 Apr 2017 00:37:21 +0200
                    [subject] => unit_test_send1_ęĘóÓąĄśŚłŁżŻźŹćĆńŃ
                    [Subject] => unit_test_send1_ęĘóÓąĄśŚłŁżŻźŹćĆńŃ
                    [message_id] => <e4bd310c-9b65-c8b6-adb5-d4c4426002fb@gmail.com>
                    [toaddress] => example1 <abc@example1.pl>
                    [to] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [personal] => example1 
                                    [mailbox] => abc
                                    [host] => example1
                                )

                        )

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

                        )

                    [ccaddress] => cc1@example1.pl, cc2@example1.pl
                    [cc] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [mailbox] => cc1
                                    [host] => example1.pl
                                )

                            [1] => stdClass Object
                                (
                                    [mailbox] => cc2
                                    [host] => example1.pl
                                )

                        )

                    [bccaddress] => bcc2@example1.pl, bcc1@example1.pl
                    [bcc] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [mailbox] => bcc2
                                    [host] => example1.pl
                                )

                            [1] => stdClass Object
                                (
                                    [mailbox] => bcc1
                                    [host] => example1.pl
                                )

                        )

                    [reply_toaddress] => ....
                    [reply_to] => Array
                        (
                            ...

                        )

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

                        )

                    [Recent] =>  
                    [Unseen] =>  
                    [Flagged] =>  
                    [Answered] =>  
                    [Deleted] =>  
                    [Draft] =>  
                    [Msgno] =>    1
                    [MailDate] =>  5-Apr-2017 22:37:22 +0000
                    [Size] => 5546
                    [udate] => 1491431842
                )

        )
mattparksjr commented 7 years ago

This may be an issue with some old code. Just got a pc so I'll be working on this

TrueShutDown commented 7 years ago

any solutions?

mattparksjr commented 7 years ago

Got back yesterday. I will look at today as soon as I get out of bed...

mattparksjr commented 7 years ago

I haven't seen the code in a bit, try a temporary downgrade and tell me if it ever worked in the first place

TrueShutDown commented 7 years ago

How can I downgrade and to which version? I use composer

  "require": {
    "ssilence/php-imap-client": "dev-master"
  },
aresofficial commented 6 years ago

Hello. How can i solve this issue?

Daxyhr commented 6 years ago

This issue is solved by changing the following:

ImapClient.php

    public function imapHeaderInfo($id)
    {
        return imap_headerinfo($this->imap, $id);
    }

change into:

    public function imapHeaderInfo($id)
    {
        return imap_rfc822_parse_headers(imap_fetchheader($this->imap, $id));
    }

IncomingMessage.php

    protected function imapHeaderInfo()
    {
        return imap_headerinfo($this->imapStream, $this->id);
    }

change into:

    protected function imapHeaderInfo()
    {
        return imap_rfc822_parse_headers(imap_fetchheader(($this->imapStream, $this->id));
    }

See:

mattparksjr commented 6 years ago

Hello. We accept all help @Daxyhr. However to properly credit you you need to submit a pull request with these changes

Daxyhr commented 6 years ago

@xXXIMMATTHEWXXx I'm trying to figure out how that works. Thats why I just posted the solution here. I just pointed to a solution that I found online when I runned into the issue above.

[update] I think I made a pull request now.