IMAP Email Node Archive Mail

I was thinking of creating an workflow that would get the email from an Archive folder in an email client. The only problem is, that the IMAP Email Node will only process message that are unread before they are move to the Archived folder. Any ideas whether this is at all possible?

Hey @dickhoning, this would be the nodeā€™s default behaviour.

You can use the Custom email rules option to customize which emails it should process:

image

@MutedJam thanks, but unfortunately, there does not seem to be an option for my issue, which is taking in already read/seen message ā€¦

Hey @dickhoning,

What happens if you skip the Unseen part in the search filter?

@Jon when I drag an email message from my Inbox to my Archive folder via my email client, the nothing happens with the following settings ā€¦ with or without the [ā€œUNSEENā€] Custom email rule option ā€¦

Hey @dickhoning,

If you have an unseen email in Archive does that work?

Hey @dickhoning, I did some more testing on this and something like ["ALL", ["SINCE", "April 20, 2010"]] in the Custom email rules field also caused already seen messages to trigger the IMAP Email node. It did, however, only work for messages just moved to the actual INBOX, not any other folders like Archive or a newly created folder for me.

So maybe you could simply create a separate IMAP account for use with n8n which lets you use the top level of your INBOX? So instead of moving a message into the Archive folder for parsing, you could simply move it to the additional account.

Hi @MutedJam thanks for thinking out of the box for me ā€¦ but uh ā€¦ Iā€™m afraid that this is not going to work in this case. What Iā€™m really looking for in this use case, is the possibility of processing mail messages that are moved into an ā€˜Archiveā€™ folder. This so that users can drag messages that they want to archive in their ERP system. Additionally, Iā€™m looking for a method to delete an archived mail.

Might be worth raising a feature request then. I tried playing around with this node a bit more (e.g. specifying a subfolder using something like INBOX.n8n as the mailbox name where n8n is the subfolder name, but the trigger would not run for messages simply moved into that folder). Sorry I donā€™t have any better news here :frowning:

There is a chance this is specific to my email provider (I donā€™t really know much about the IMAP protocol unfortunately), so it might be worth testing this on your end as well.

I have just given this a quick test and I have a mailbox called Archive that contains 3 read emails.

In my IMAP node I haveā€¦

This has resulted in all 3 emails appearing in my worklfow. I am not sure what the differences are maybe it is where I am using GMail for my testing.

Did this work for you when your workflow is active and an existing message gets moved into ā€œArchiveā€ @jon? For me it was only working when manually executing the workflow (I was using these guys instead of Gmail though and n8n was a subfolder of INBOX in my case).

Yup if I moved those 3 into Inbox then set the logging of my flow to show in execution log and active it, When I move the 3 back into Archive I can see it run.

image

1 Like

Thatā€™s pretty neat. So I guess the tl;dr is that it can work if youā€™re using the right provider and/or your Archive folder is an entirely separate mailbox.

I consider this good news!

Just to be complete, Just did the same test using GMX as the mail provider and it also works.

1 Like

Nice, with your latest test I could see the different structure between GMX/Gmail and Telekom @Jon.

Telekom seems to allow subfolders of INBOX only whereas GMX and Gmail allow the use of top level inboxes.

@dickhoning, could you confirm whether you tried setting a custom rule like ["ALL"] as in Jonā€™s screenshot above? If this is still not working for you, could you confirm your email provider?

1 Like

@MutedJam rule [ā€œALLā€] works :+1: ā€¦ the million dollar question now is; ā€˜is there an option to move the archived message to another folder?ā€™

1 Like

Hey @dickhoning,

Sounds like that would need a feature request to add a Move action on the IMAP node.

1 Like

I will submit a request for this ā€¦

1 Like

I created an n8n community node, n8n-nodes-imap, which is now available for use. Please test this node and share your experiences or suggestions.

Github repo: GitHub - umanamente/n8n-nodes-imap

1 Like

Oh wow, I love this initiative :heart_eyes:

Thanks so much for sharing @AutoBot!