Subject: [lemonade] [Lemonade] Forwarded Flag support for Gmail account

From: Jayantheesh S B <[email-masked]>
Date: Wed, 16 Jul 2014 15:01:44 +0000

Hi All,

We see inconsistent behavior of **Forwarded** Flag with Gmail account. I have configured two Gmail accounts in my device.
For one account I get "$Forwarded" flag support as part of PERMANENTFLAGS and for other I did not receive.  Please find the log snippet below.

Do we need to enable any settings to receive this Flag support as part of the response. Kindly share your thoughts.

Sample Log snippet with Gmail accounts:
Gmail Account 1:
07-16 10:52:22.084  8995  9013 D Email   : >>> 98 SELECT "Inbox"
07-16 10:52:22.224  8995  9013 D Email   : <<< #null# ["FLAGS", ["\Answered", "\Flagged", "\Draft", "\Deleted", "\Seen", "$Phishing", "$NotPhishing"]]
07-16 10:52:22.234  8995  9013 D Email   : <<< #null# ["OK", ["PERMANENTFLAGS", ["\Answered", "\Flagged", "\Draft", "\Deleted", "\Seen", "$Phishing", "$NotPhishing", "\*"]], "Flags permitted."]
07-16 10:52:22.234  8995  9013 D Email   : <<< #null# ["OK", ["UIDVALIDITY", "1"], "UIDs valid."]
07-16 10:52:22.234  8995  9013 D Email   : <<< #null# ["1248", "EXISTS"]
07-16 10:52:22.244  8995  9013 D Email   : <<< #null# ["0", "RECENT"]
07-16 10:52:22.244  8995  9013 D Email   : <<< #null# ["OK", ["UIDNEXT", "1303"], "Predicted next UID."]
07-16 10:52:22.244  8995  9013 D Email   : <<< #null# ["OK", ["HIGHESTMODSEQ", "168751"]]
07-16 10:52:22.254  8995  9013 D Email   : <<< #98# ["OK", ["READ-WRITE"], "Inbox selected. (Success)"]

Gmail Account 2:
07-16 10:53:11.804  8995  9013 D Email   : >>> 88 SELECT "Inbox"
07-16 10:53:12.294  8995  9013 D Email   : <<< #null# ["FLAGS", ["\Answered", "\Flagged", "\Draft", "\Deleted", "\Seen", "$Phishing", "$Forwarded", "$NotPhishing"]]
07-16 10:53:12.294  8995  9013 D Email   : <<< #null# ["OK", ["PERMANENTFLAGS", ["\Answered", "\Flagged", "\Draft", "\Deleted", "\Seen", "$Phishing", "$Forwarded", "$NotPhishing", "\*"]], "Flags permitted."]
07-16 10:53:12.304  8995  9013 D Email   : <<< #null# ["OK", ["UIDVALIDITY", "649767801"], "UIDs valid."]
07-16 10:53:12.304  8995  9013 D Email   : <<< #null# ["7828", "EXISTS"]
07-16 10:53:12.314  8995  9013 D Email   : <<< #null# ["0", "RECENT"]
07-16 10:53:12.314  8995  9013 D Email   : <<< #null# ["OK", ["UIDNEXT", "10112"], "Predicted next UID."]
07-16 10:53:12.314  8995  9013 D Email   : <<< #null# ["OK", ["HIGHESTMODSEQ", "1003549"]]
07-16 10:53:12.324  8995  9013 D Email   : <<< #88# ["OK", ["READ-WRITE"], "Inbox selected. (Success)"

Regards,
Jay

---

From: Dave Cridland <[email-masked]>
Date: Wed, 16 Jul 2014 16:10:30 +0100

On 16 July 2014 16:01, Jayantheesh S B <[email-masked]> wrote:

>  We see inconsistent behavior of ***Forwarded*** Flag with Gmail account.
> I have configured two Gmail accounts in my device.
>
>  For one account I get “$Forwarded” flag support as part of
> PERMANENTFLAGS and for other I did not receive.  Please find the log
> snippet below.
>
>
>
Account 1 has previously used the $Forwarded flag, Account 2 has not. Both
accounts can set it, though, as the server tells you new flags can be
created.

Dave.

---

From: Jayantheesh S B <[email-masked]>
Date: Wed, 16 Jul 2014 15:40:37 +0000

Thanks for your response Dave.

Shall we consider the PERMANENTFLAGS returned as part of SELECT IMAP command to decide, whether **Forwarded** flag is supported by the IMAP server (similar to CAPABILITIES response)?

Some IMAP servers like AOL Yahoo, by default its returning Forwarded flag as part of SELECT. Gmail IMAP server return only when flag is set. Kindly share your thoughts.

IMAP RFC Snippet:
         OK [PERMANENTFLAGS (<list of flags>)]
                     A list of message flags that the client can change
                     permanently.  If this is missing, the client should
                     assume that all flags can be changed permanently.

How client can decide Forwarded Flag is supported by remote IMAP server ?

Regards,
Jay
From: Dave Cridland [mailto:[email-masked]]
Sent: Wednesday, July 16, 2014 11:11 AM
To: Jayantheesh S B
Cc: [email-masked]
Subject: Re: [lemonade] [Lemonade] Forwarded Flag support for Gmail account

On 16 July 2014 16:01, Jayantheesh S B <[email-masked]<mailto:[email-masked]>> wrote:
We see inconsistent behavior of **Forwarded** Flag with Gmail account. I have configured two Gmail accounts in my device.
For one account I get “$Forwarded” flag support as part of PERMANENTFLAGS and for other I did not receive.  Please find the log snippet below.

Account 1 has previously used the $Forwarded flag, Account 2 has not. Both accounts can set it, though, as the server tells you new flags can be created.

Dave.

---

From: Dave Cridland <[email-masked]>
Date: Wed, 16 Jul 2014 16:50:14 +0100

On 16 July 2014 16:40, Jayantheesh S B <[email-masked]> wrote:

>  Shall we consider the PERMANENTFLAGS returned as part of SELECT IMAP
> command to decide, whether ***Forwarded*** flag is supported by the IMAP
> server (similar to CAPABILITIES response)?
>
>
I don't understand your problem.

Google is saying that in both mailboxes, any flag may be created and used
(because \* is listed), and on one account, $Forwarded already has been.

Dave.

---

From: Jayantheesh S B <[email-masked]>
Date: Wed, 16 Jul 2014 16:04:27 +0000

Dave,

Here is my plan.

We have added support to set and get the **forwarded** flag from IMAP server.  All the available IMAP server in the market does not support this feature.

So, to differentiate between supported and unsupported IMAP server, we decide based on the PERMANENTFLAG response contains “FORWARDED” flag or not.

Is this the right approach ? This approach works with all the available servers like AOL, YAHOO, Telia, Isode etc. But Gmail behaves differently.

If the above approach is not correct to decide this feature is supported by the IMAP server, How client can decide the availability of this feature in server ?

Regards,
Jay
From: Dave Cridland [mailto:[email-masked]]
Sent: Wednesday, July 16, 2014 11:50 AM
To: Jayantheesh S B
Cc: [email-masked]
Subject: Re: [lemonade] [Lemonade] Forwarded Flag support for Gmail account

On 16 July 2014 16:40, Jayantheesh S B <[email-masked]<mailto:[email-masked]>> wrote:
Shall we consider the PERMANENTFLAGS returned as part of SELECT IMAP command to decide, whether **Forwarded** flag is supported by the IMAP server (similar to CAPABILITIES response)?

Google is saying that in both mailboxes, any flag may be created and used (because \* is listed), and on one account, $Forwarded already has been.

Dave.

---

From: Jan Kundrát <[email-masked]>
Date: Wed, 16 Jul 2014 18:21:18 +0200

On Wednesday, 16 July 2014 18:04:27 CEST, Jayantheesh S B wrote:
> So, to differentiate between supported and unsupported IMAP 
> server, we decide based on the PERMANENTFLAG response contains 
> “FORWARDED” flag or not.
>
> Is this the right approach ?

Nope.

> This approach works with all the 
> available servers like AOL, YAHOO, Telia, Isode etc. But Gmail 
> behaves differently.

Wrong.

> If the above approach is not correct to decide this feature is 
> supported by the IMAP server, How client can decide the 
> availability of this feature in server ?

As Dave have told you, if the server says in the PERMANENTFLAGS response 
that it accepts \*, it means that you can create arbitrary flags. Yes, this 
means that you can create a flag named "$Forwarded".

Of course if the PERMANENTFLAGS already contains $Forwarded, you can create 
that flag even when the server does not say that you can create arbitrary 
flags. You can also asume the same when there is no PERMANENTFLAGS 
response, btw.

Hope this helps. It's also described in 
http://tools.ietf.org/html/rfc3501#page-64 . Have you read that? Do you 
understand the textual description of the PERMANENTFLAGS response code?

With kind regards,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/