Imap - How to search a sentence with Chilkat Xojo Plugin

I’m trying this code, it only work to search a word but not a sentence separated by space.
I’m wondering why.

https://www.example-code.com/xojo/imap_deleteEmail.asp

The code you linked only appears to search for “FTP2”, not a word or sentence. Can you show us yuor code section that in not doing what you expect?

If you paste into a forum message, please prefix and suffix with three back ticks, or highlight the block and click the forum preformatted text icon ( </> ) in the message pane. This makes code MUCH more readable in a message.

1 Like
GetWord =  "Testing Sentence"
messageSet = imap1.Search("SUBJECT " + GetWord,fetchUids)

Always return failed when the email exist. If I just search Testing, it works.

I don’t know anything about IMAP, but what if you encode the query using EncodeURLComponent (in other words, replace the space with %20)?

GetWord =  EncodeURLComponent("Testing Sentence")
messageSet = imap1.Search("SUBJECT " + GetWord,fetchUids)

Same result. I see that in the documentation

Note: It seems that Microsoft IMAP servers, such as outlook.office365.com and imap-mail.outlook.com do not support anything other than 7bit us-ascii chars in the search criteria string, regardless of the SEARCH charset that might be specified.

Everything I saw about multi word searches had quotes around the search string… Maybe that?

2 Likes

BINGO ! Thanks a lot