Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error searching for Gmail emails started "xm003 BAD Could not parse command" #197

Open
shay-rm opened this issue Sep 29, 2016 · 7 comments

Comments

@shay-rm
Copy link

shay-rm commented Sep 29, 2016

Two days ago we started getting the following error when searching for emails after a particular date from a Gmail account:

xm003 BAD Could not parse command

   at AE.Net.Mail.ImapClient.Search(String criteria, Boolean uid) in c:\Repos\aenetmail\ImapClient.cs:line 703
   at AE.Net.Mail.ImapClient.Search(SearchCondition criteria, Boolean uid) in c:\Repos\aenetmail\ImapClient.cs:line 691
   at ....

We didn't make any changes to the code. Anyone else start experiencing this when querying Gmail?

@mattiasmoser
Copy link

mattiasmoser commented Sep 29, 2016

I am experiencing something very similar here, getting the exception below when searching for emails after a specific date using SearchCondition SentSince(datetime).

Stack Trace:

System.Exception: xm004 BAD Could not parse command
at AE.Net.Mail.ImapClient.Search(String criteria, Boolean uid)
at AE.Net.Mail.ImapClient.Search(SearchCondition criteria, Boolean uid)
at ...

@537mfb
Copy link

537mfb commented Oct 1, 2016

Also running into this - gmail only - other mail servers don't throw this
Couldn't figure out what causes this but other mail libraries seem to be getting this aswell
example: nblagoev/Gmail.ps#14

@ReneNP
Copy link

ReneNP commented Oct 3, 2016

We are experiencing the exact samme issue using the "Since" field on SearchCondition.

First I was able to prevent the error by setting the Value property of SearchCondition to a string with no time (instead of a DateTime):

SearchCondition condition = new SearchCondition();
condition.Field = SearchCondition.Fields.Since;
condition.Value = new DateTime(2016, 10, 1).ToString("dd-MMM-yyyy");

Then 2-3 days later that solution stopped working. And now I am using one of Gmail's IMAP extensions:

SearchCondition condition = new SearchCondition();
condition.Value = string.Format(@"X-GM-RAW ""AFTER:{0:yyyy-MM-dd}""", new DateTime(2016, 10, 1));

Currently I am only using the library with Gmail - I don't think the above "fix" would work with other providers.

@537mfb
Copy link

537mfb commented Oct 3, 2016

Thanks @ReneNP - That solution in a ternary will work for me
If it's gmail use Gmail extension otherwise use regular search command

Would be nice to now why the regular search command no longer works with Gmail though

@TroyWalshProf
Copy link

It looks like the issue is that GMail is no longer able to handle the SearchCondition.GetRFC2060Date format.
See related Gmail help forum

Note* Per IMAP RFC 3501 & 2060 it looks like SentSince should be Date and not Date-Time
So search is sending something like this:

SEARCH SENTSINCE "28-Oct-2016 13:55:27 -05"

but should be sending

SEARCH SENTSINCE "28-Oct-2016"

@saurabhabh
Copy link

Any update on this issue. Facing the same problem with Gmail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@ReneNP @537mfb @TroyWalshProf @mattiasmoser @saurabhabh @shay-rm and others