Repository: barbushin/php-imap

Issue #443: Can't get content of sent mail 
Created: 2020-01-24T11:08:11Z
Environment

PHP IMAP version: [3.0.33]
PHP Version: [7.3.13]
Type of execution: [Web Server]
Imap Server : Exchange from OVH

$email->textPlain  and $email->textHtml returns "" on sent mails. It works well in the Inbox but the sent mails never have any content.
$mailbox->getRawMail($emailId) returns :
"""
From: Me<richard@mydomain.be>\r\n
To: "acq@mydomain.fr" <acq@mydomain.fr>\r\n
Subject: =?utf-8?B?SGVsbG8gY29tbWVudCDDp2EgdmEgPyA=?=\r\n
Thread-Topic: =?utf-8?B?SGVsbG8gY29tbWVudCDDp2EgdmEgPyA=?=\r\n
Thread-Index: AQHV0GPzqyrcU1Ecjk2Iti68kJTd9Q==\r\n
Date: Tue, 21 Jan 2020 15:06:21 +0100\r\n
Message-ID: <96302730bbb54a0092fd30f41c9ef835@mydomain.be>\r\n
Content-Language: fr-FR\r\n
X-MS-Has-Attach:\r\n
X-MS-Exchange-Organization-SCL: -1\r\n
X-MS-TNEF-Correlator:\r\n
X-MS-Exchange-Organization-RecordReviewCfmType: 0\r\n
Content-Type: text/html; charset="utf-8"\r\n
Content-Transfer-Encoding: base64\r\n
MIME-Version: 1.0\r\n
\r\n
PGh0bWw+DQo8aGVhZD4NCjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0i\r\n
dGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyIgc3R5bGU9\r\n
ImRpc3BsYXk6bm9uZTsiPjwhLS0gUCB7bWFyZ2luLXRvcDowO21hcmdpbi1ib3R0b206MDt9IC0t\r\n
Pjwvc3R5bGU+DQo8L2hlYWQ+DQo8Ym9keSBkaXI9Imx0ciI+DQo8ZGl2IGlkPSJkaXZ0YWdkZWZh\r\n
dWx0d3JhcHBlciIgc3R5bGU9ImZvbnQtc2l6ZToxMnB0O2NvbG9yOiMwMDAwMDA7Zm9udC1mYW1p\r\n
bHk6Q2FsaWJyaSxIZWx2ZXRpY2Esc2Fucy1zZXJpZjsiIGRpcj0ibHRyIj4NCjxwPlN1cGVyIGJp\r\n
ZW4gZXQgdG9pID8mbmJzcDs8L3A+DQo8cD48YnI+DQo8L3A+DQo8cD5KJ2FpIGjDonRlIGQnYXZv\r\n
aXIgZGUgdGVzIG5vdXZlbGxlcyAhJm5ic3A7PHNwYW4+8J+Yqjwvc3Bhbj48L3A+DQo8cD48c3Bh\r\n
bj48YnI+DQo8L3NwYW4+PC9wPg0KPHA+PHNwYW4+PGJyPg0KPC9zcGFuPjwvcD4NCjxwPjxzcGFu\r\n
PkJJc291czwvc3Bhbj48L3A+DQo8L2Rpdj4NCjwvYm9keT4NCjwvaHRtbD4NCg==\r\n
"""

To Reproduce
Steps to reproduce the behavior.
The used code:
$imapPath = '{'.$imapHost.':'.$imapPort.'/imap/ssl/novalidate-cert}';

$mailbox = new Mailbox(
                    $imapPath,
                    $mailboxEmailAddress,
                    $mailboxPassword
                );

 $folders = $mailbox->getListingFolders();
 $mailbox->setServerEncoding('US-ASCII');

 foreach ($folders as $folder) {
       $mailbox->switchMailbox($folder);
       $emails = $mailbox->searchMailbox(''); 
         foreach ($emails as $emailId){
                                $mailContent = $mailbox->getMail($emailId);
                                var_dump($mailbox->getRawMail($emailId));
                                var_dump($mailContent->textPlain);
        }
}
The raw headers of the parsed email :
 MIME-Version: 1.0\r\n
    From: Richard Raduly <richard@mydomain.be>\r\n
    To: "acq@mydomain.fr" <acq@mydomain.fr>\r\n
    Subject: =?utf-8?B?SGVsbG8gY29tbWVudCDDp2EgdmEgPyA=?=\r\n
    Thread-Topic: =?utf-8?B?SGVsbG8gY29tbWVudCDDp2EgdmEgPyA=?=\r\n
    Thread-Index: AQHV0GPzqyrcU1Ecjk2Iti68kJTd9Q==\r\n
    Date: Tue, 21 Jan 2020 15:06:21 +0100\r\n
    Message-ID: <96302730bbb54a0092fd30f41c9ef835@mydomain.be>\r\n
    Content-Language: fr-FR\r\n
    X-MS-Has-Attach:\r\n
    X-MS-Exchange-Organization-SCL: -1\r\n
    X-MS-TNEF-Correlator:\r\n
    X-MS-Exchange-Organization-RecordReviewCfmType: 0\r\n
    Content-Type: text/html; charset="utf-8"\r\n
    Content-Transfer-Encoding: base64\r\n

Expected behavior
Return the content of the sent mail
Additionnal info
I think Gmail has the same issue

Duplicate issue #413: How to read Sent/Junk box or other folders ?
Created: 2019-12-26T09:58:36Z
How to read Sent/Junk box or other folders ?

Closing comment (2020-01-27T14:09:50Z): Related to #443.