Ansh Vijay
Ansh Vijay

Reputation: 1

GMAIL mails providing messageId with special characters not able to search query IMAP

I am trying use IMAP to fetch mails send by GMAIL. But the problem which I am facing is when I am trying to pass the command through which I can fetch mails from IMAP it is giving response count 0 as the incoming messageId from GMAIL includes some special characters due to which my IMAP is not returning any mail as it is not recognising the messageId.

So what I am stuck on is I want to somehow pass the entire messageId with special character (=, + particularly in my case) to be passed and fetch me a result.

Example message ID from GMAIL which are not working due to + or = -

<CAFUuS3vuQ1VfbQck=t_DEZA-mGkxcOBkpb8SdntDGqHMAu5ZQw@mail.gmail.com>
<CAFUuS3vuQ1VfbQck+t_DEZA-mGkxcOBkpb8SdntDGqHMAu5ZQw@mail.gmail.com>

Working IDs -

<CAFUuS3vuQ1VfbQckt_DEZA-mGkxcOBkpb8SdntDGqHMAu5ZQw@mail.gmail.com>

Code which I am using to fetch the mail -

const searchQuery = [["HEADER", "Message-ID",  messageId]];

Module used - NODE-IMAP

NOTE - I also verified that the mail exists with these messageId as they can be seen while fetching all mails. But the case particularly holds back in case of search query.

I tried to pass it with "\" so that somehow it can recognise it. I also tried UTF-8 conversion and URL encode and decode.

Upvotes: 0

Views: 43

Answers (0)

Related Questions