IMAP mark as read only after the workflow is done

Im currently using the IMAP Read Email trigger, and I would like to only mark the email as read after the workflow has successfully completed.

Since I’m using Gmail, im trying to take advantage of the Gmail node to mark the email as read, however I can’t find the message id.

Is this something possible to do?

Hey @Couto!

The IMAP Read Email node doesn’t give the Message ID that you can use with the Gmail node. However, there is a workaround. You can use the Get All operation and use the Query option. You can use a query to get the message that you received from the IMAP Read Email node.

Hope this helps :slight_smile:

Yeah that’s what I thought, however I’m having some trouble in finding the right query :cry:

Do you have any query examples that I could use as a guide? It doesn’t have to be an exact query for my problem, just some example that I could use to figure out how to do queries.

I used this query from:{{$node["IMAP Email"].json["from"]}} subject:{{$node["IMAP Email"].json["subject"]}} You can even add is:unread to make sure that you get only the email that is unread.

1 Like

Yeah, I got to find the query documentation by accident and was able to reach a similar query than yours!
The query I’ve used, and it seems to be working for my use case is: in:INBOX is:unread from:{{$node["IMAP Email"].json["from"]["text"]}} subject:{{$node["IMAP Email"].json["subject"]}}

Thank you!

For future reference, the query options docs live here: https://support.google.com/mail/answer/7190

This is the workflow I’m using right now:

1 Like

Thanks for sharing! I will add it our documentation as well!

Have fun :slight_smile:

1 Like

This is no longer relevant for my problem, but taking the opportunity to share my opinion:

While this works nicely for Gmail, I do expect to connect the IMAP Email to a protonmail bridge, this same solution won’t work for that use case I believe. It would be nice to have an IMAP manipulation node in the future. I’m not sure if node-imap allows for search + delete labels operations, but that could be a start, even if we have to pull emails twice (once to receive the email, and then to search and mark as read)

That’s a good suggestion. Can you make a feature request for this? We can collect more insights from other members, and learn from their use-case as well! Once we know how the community wants this feature to be (and if it possible with node-imap) we can implement this.

Hi Gents.
Thanks for sharing @Couto.
IMAP Read Email can be applied to read outlook exchange mailbox?

Hey @hermanmaleiane!

Yes, it can be used for Outlook as well. You need to configure the node to work with your Outlook account.

1 Like