imapsync icon indicating copy to clipboard operation
imapsync copied to clipboard

I am not able to search - server returns ALL messages, but while searching FROM, results in 0

Open elvisef opened this issue 5 years ago • 1 comments

Weird thing but I tried manually connect to IMAP. I wanted to move messages from one folder to another on the same server.

If I use a1 SEARCH ALL it searches and finds ALL messages - I see all UID's (about 1292) 2021-03-31_16-03

But If I use a1 SEARCH FROM "[email protected]" while email from [email protected] is in my inbox, exactly in the folder I am searching it for, nothing is found - 0 results, no UID's on the list 2021-03-31_16-03_1

I am writing about this, because the problem persists for me for a long time. This may be a server restriction, but I did not know. Firstly I tried imapsync of course, but nothing happened - I've even contacted You, no answer.

Server says that "capability" contains SEARCH option 2021-03-31_16-06

I've even tried "noabletosearch", but it did not help. It's the same server on "both" sides so I tried noabletosearch1 and noabletosearch2 as well.

Messages are there. But they're visible only if I use to search ALL. If I want to search for a specific email in the FROM field it contains, 0 results. Both in imapsync and on the server imap directly.

What could be the culprit here ? Have You got any idea ?

Im attaching one of my logs. [email protected][email protected]

elvisef avatar Mar 31 '21 14:03 elvisef

I'm sorry for the delay. You proved that this imap server honors the SEARCH ALL imap command but not the SEARCH FROM one. Some crappy developed imap servers just implement SEARCH ALL to list messages. What is yours?

A solution is to fix the server. I bet it is not very possible.

Another solution is to use imapsync --skipmess option. It is tricky since --skipmess skips messages matching a regex but what you want is to pass messages matching a regex. For example, to pass messages that match a sender "[email protected]" use this:

imapsync ... --skipmess 'm{\A(?!.*^From:[^\n]*foobar\@example\.com)}xms'

Tell me if it works for you. I leave you the detailed explanation as an exercice.

gilleslamiral avatar Apr 06 '21 13:04 gilleslamiral