php-imap-client icon indicating copy to clipboard operation
php-imap-client copied to clipboard

Duplicate properties neither of which work!

Open abdullahseba opened this issue 8 years ago • 64 comments

Hi again There is a header.seen and header.details.Unseen. Both don't seem to do anything, I marked a message as unread and header.seen had 1 and header.details.Unseen was still empty. Same if I send a new message.

 {
        "header": {
            "subject": "testo",
            "from": "Abdullah Seba <*****@***.com>",
            "to": " ** shop <**@***uk>",
            "date": "Thu, 20 Apr 2017 00:04:26 +0000",
            "message_id": "<**@**.eurprd09.prod.outlook.com>",
            "size": 48087,
            "uid": 220,
            "msgno": 17,
            "recent": 0,
            "flagged": 0,
            "answered": 0,
            "deleted": 0,
            "seen": 1,  //<<<<<<<<<<<------------------ this one
            "draft": 0,
            "udate": 1492646668,
            "details": {
                "date": "Thu, 20 Apr 2017 00:04:26 +0000",
                "Date": "Thu, 20 Apr 2017 00:04:26 +0000",
                "subject": "testo",
                "Subject": "testo",
                "message_id": "<**@**.eurprd09.prod.outlook.com>",
                "toaddress": "** <**@**.org.uk>",
                "to": [
                    {
                        "personal": "",
                        "mailbox": "**",
                        "host": "**.uk"
                    }
                ],
                "fromaddress": "Abdullah Seba <**@**.com>",
                "from": [
                    {
                        "personal": "Abdullah Seba",
                        "mailbox": "**",
                        "host": "outlook.com"
                    }
                ],
                "Recent": " ",
                "Unseen": " ", //<<<<<<<<<<<------------------ and this one
                "Flagged": " ",
                "Answered": " ",
                "Deleted": " ",
                "Draft": " ",
                "Msgno": "  17",
                "MailDate": "20-Apr-2017 01:04:28 +0100",
                "Size": "48087",
                "udate": 1492646668
            }
    

abdullahseba avatar Apr 20 '17 00:04 abdullahseba

Might be office 365 cuz when I refresh office it sometimes un does what I did. Have to look into it Still the duplicate tho.

abdullahseba avatar Apr 20 '17 07:04 abdullahseba

image

abdullahseba avatar Apr 20 '17 07:04 abdullahseba

Ok. Questions:

  1. You first had 1 unread message. You have web interface and in it you see that the letter is not read?

  2. You took it with getMessage(). And looked

$imap->inMess->header

Yes or No ?

  1. The letter became read? Yes or No ?

  2. Do you want to set it as not read?

  3. To do this, you use $imap->setUnseenMessage() method?

  4. You open the interface and the letter is read again?

P.S. When using getMessage() method, the letter is marked as read.

sergey144010 avatar Apr 20 '17 10:04 sergey144010

And 'details' property

$imap->inMess->header->details

Just uses it

imap_headerinfo($this->imapStream, $this->id);

This is a Php built-in function. See http://php.net/manual/ru/function.imap-headerinfo.php

Unseen - U if not seen AND not recent, ' ' if seen OR not seen and recent 

sergey144010 avatar Apr 20 '17 10:04 sergey144010

When I use the web interface and use $imap->setUnseenMessage() method, the update in the web interface does not happen instantly, it is necessary to switch between folders, and then an unread message will appear.

sergey144010 avatar Apr 20 '17 10:04 sergey144010

I have not got to the bit that reads mail in the interface yet. All I'm doing is $imap->getMessages() I think its a problem with the office interface. I'll check with Gmail and let you know. What about header.details.Unseen?

abdullahseba avatar Apr 20 '17 15:04 abdullahseba

Cant get anything out of gmail....

abdullahseba avatar Apr 20 '17 16:04 abdullahseba

$emails = $imap->getMessages(); returns this in gmail: Notice: Unknown: Invalid quoted-printable sequence: =n&p=inboxcategories_all> [image: Customize] Customize your inbox If you see (errflg=3) in Unknown on line 0

works fine in office 365!

abdullahseba avatar Apr 20 '17 16:04 abdullahseba

What this?

inboxcategories_all

Do you use it?

$imap = new ImapClient([
    ...
    'mailbox' => [
        'remote_system_name' => 'imap.server.ru',
        'mailbox_name' => INBOX.categories,
    ],
...
]);

or

$imap = new ImapClient([
    ...
    'mailbox' => [
        'remote_system_name' => 'imap.server.ru',
        'mailbox_name' => INBOX/categories,
    ],
...
]);

sergey144010 avatar Apr 20 '17 16:04 sergey144010

No, I don't. Its just $imap->getMessages() exact same code that works with 365 but returns this.

abdullahseba avatar Apr 20 '17 16:04 abdullahseba

try this

$imap = new ImapClient([
    ...
    'mailbox' => [
        'remote_system_name' => 'imap.server.ru',
        'mailbox_name' => INBOX,
    ],
...
]);
$imap->selectFolder(categories);
$emails = $imap->getMessages();

sergey144010 avatar Apr 20 '17 17:04 sergey144010

why? isn't that the advanced connection?

abdullahseba avatar Apr 20 '17 17:04 abdullahseba

That is. You do not have a folder separator here.

inboxcategories_all

sergey144010 avatar Apr 20 '17 17:04 sergey144010

I believe your issue is not connecting to the default folder @abdullahseba. As @sergey144010 said, try and use the default then switch.

mattparksjr avatar Apr 22 '17 02:04 mattparksjr

Do note @abdullahseba that an advanced connection is highly recommended.

mattparksjr avatar Apr 22 '17 02:04 mattparksjr

I can reproduce this issue and debugged this issue. When using ImapClient::getMessages, each message is retrieved by the getMessage() function, which lead to IncomingMessage::init().

In this function, the getHeader() method is called AFTER getAttachments (which marks the e-mail as read/seen). In my opinion the getHeader() should be right before the getAttachments.

JerBlo avatar Apr 25 '17 08:04 JerBlo

Yep its defiantly not outlook now. As soon as I refresh the client my emails get read.

abdullahseba avatar Apr 25 '17 11:04 abdullahseba

@JerBlo's solution seems to be the most logical.

mattparksjr avatar Apr 25 '17 11:04 mattparksjr

Thats something you have to do right?

abdullahseba avatar Apr 25 '17 11:04 abdullahseba

Yes, I will commit in a minute.

mattparksjr avatar Apr 25 '17 11:04 mattparksjr

I believe this has been fixed. Let me know

mattparksjr avatar Apr 25 '17 12:04 mattparksjr

Yep seems to work. but the time is always 20 hours. Might be me but the code use to work.

abdullahseba avatar Apr 25 '17 12:04 abdullahseba

image

abdullahseba avatar Apr 25 '17 12:04 abdullahseba

Try with a fresh email please

mattparksjr avatar Apr 25 '17 12:04 mattparksjr

Cant cuz of the attachment issue #153. I have to use$emails = $imap->getMessages(10,1); I was using header.udate

abdullahseba avatar Apr 25 '17 12:04 abdullahseba

Try and send yourself a new one

mattparksjr avatar Apr 25 '17 12:04 mattparksjr

No its ok must be my js somewhere. the duplicate headers are still there tho

"header": {
            "subject": "Receipt for your PayPal payment to Bamford Trading (UK) Ltd",
            "from": "\"[email protected]\" <[email protected]>",
            "to": "Peter Spence <[email protected]>",
            "date": "Mon, 17 Apr 2017 10:39:37 +0000",
            "message_id": "<[email protected]>",
            "size": 63770,
            "uid": 177,
            "msgno": 14,
            "recent": 0,
            "flagged": 1,
            "answered": 0,
            "deleted": 0,
            "seen": 1,
            "draft": 0,
            "udate": 1492425583,
            "details": {
                "date": "Mon, 17 Apr 2017 10:39:37 +0000",
                "Date": "Mon, 17 Apr 2017 10:39:37 +0000",
                "subject": "Receipt for your PayPal payment to Bamford Trading (UK) Ltd",
                "Subject": "Receipt for your PayPal payment to Bamford Trading (UK) Ltd",
                "message_id": "<[email protected]>",
                "toaddress": "Peter Spence <[email protected]>",
                "to": [
                    {
                        "personal": "Peter Spence",
                        "mailbox": "admin",
                        "host": "e17pumphouse.org.uk"
                    }
                ],
                "fromaddress": "\"[email protected]\" <[email protected]>",
                "from": [
                    {
                        "personal": "[email protected]",
                        "mailbox": "service",
                        "host": "paypal.co.uk"
                    }
                ],
                "Recent": " ",
                "Unseen": " ",
                "Flagged": "F",
                "Answered": " ",
                "Deleted": " ",
                "Draft": " ",
                "Msgno": "  14",
                "MailDate": "17-Apr-2017 11:39:43 +0100",
                "Size": "63770",
                "udate": 1492425583
            }

abdullahseba avatar Apr 25 '17 13:04 abdullahseba

No its not fixed. I can see the mail getting marked as read in outlook as i refresh the page. Fixed the date issue (was my JS).

abdullahseba avatar Apr 25 '17 13:04 abdullahseba

They come thorough as unread than when I refresh the page again its read. I can send link if you want.

abdullahseba avatar Apr 25 '17 13:04 abdullahseba

Hm...

mattparksjr avatar Apr 25 '17 13:04 mattparksjr