+2 votes

I'm having trouble getting date search working with Yahoo IMAP connection.

I can e.g. retrieve the emails based on flag (Expression.HasFlag(Flag.Unseen)), so the connection is ok, but any date search isn't. Like

Expression.And(
    Expression.SentBefore(ImportDate.AddDays(1)),
    Expression.SentSince(ImportDate.AddDays(-1))
)

and I've also tried with SentOn etc.

These are working ok on Gmail imap so I'm just wondering, where's the catch? Has anyone had similar issues?

Any help much appreciated.

by
edited by
Turn on logging:
https://www.limilabs.com/blog/logging-in-mail-dll
There is a very good chance it's the server side problem and Yahoo is not returning any data, although the query sent is correct.
Thank you!

I tried this and it looks like all is going well, except no data returned (plenty of emails available with date range I used).

Log reports:

Mail.dll: 10 13:35:18 S: * SEARCH
Mail.dll: 10 13:35:18 S: OK UID SEARCH completed
Mail.dll: 10 13:35:26 C: SELECT "Bulk Mail"
Mail.dll: 10 13:35:26 S: * 237 EXISTS
Mail.dll: 10 13:35:27 S: * 0 RECENT
Mail.dll: 10 13:35:27 S: * OK [UIDVALIDITY xx] UIDs valid
Mail.dll: 10 13:35:27 S: * OK [UIDNEXT x] Predicted next UID
Mail.dll: 10 13:35:27 S: * FLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $Junk $NotJunk)
Mail.dll: 10 13:35:27 S: * OK [PERMANENTFLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $Junk $NotJunk)] Permanent flags
Mail.dll: 10 13:35:27 S: * OK [HIGHESTMODSEQ 6024230088435879224]
Mail.dll: 10 13:35:27 S: OK [READ-WRITE] SELECT completed; now in selected state
Mail.dll: 10 13:35:27 C: UID SEARCH (SENTBEFORE 14-Jun-2014 SENTSINCE 08-Jun-2014)
Mail.dll: 10 13:35:27 S: * SEARCH
Mail.dll: 10 13:35:27 S: OK UID SEARCH completed


Thanks,

M

1 Answer

0 votes

This is the server side problem it seems that Expression.SentBefore doesn't work correctly on Yahoo IMAP server.

IMAP protocol equivalent of this expression is SENTBEFORE. It examines email's Date: header.

It appears that although SENTSINCE doesn't work, SENTSINCE (Expression.SentSince), BEFORE (Expression.Before) and SINCE (Expression.Since) do work correctly. BEFORE and SINCE use email's INTERNALDATE recorded by the IMAP server instead of Date: header.

9823377aae664ac5 UID FETCH 14614 (UID INTERNALDATE ENVELOPE)
* 1 FETCH (UID 14614 INTERNALDATE "13-Jun-2014 15:02:08 +0000" ENVELOPE ("Fri, 13 Jun 2014 15:02:08 +0000" "test2" NIL NIL NIL NIL NIL NIL NIL NIL))

a7047b7ae00645ae UID SEARCH BEFORE 14-Jun-2014
* SEARCH 14614
a7047b7ae00645ae OK UID SEARCH completed

66bfcdbe65894e4c UID SEARCH SENTBEFORE 14-Jun-2014
* SEARCH
66bfcdbe65894e4c OK UID SEARCH completed

The fact is that Yahoo IMAP implantation is buggy. Once, the server assigned "17-Jan-1970 05:37:46 +0000" as an INTERNALDATE to one of my emails, just to change that on the next login.

by (301k points)
...