IMAP Email is not working correctly with Gmail

Description:

Hi. I’m having trouble with IMAP Email for Gmail. What I want is to:

  • Read new coming email.
  • Parse content & Add new row to Google Sheets.
  • Mark As Read that email.

Problem:

It didn’t run as expected. The email is just marked as read, but the content is not parsed and there’s no content is appended to Google Sheets, which can be understood that the entire workflow is not running at all (without error). I check the mailbox and the email is marked as read, but there’s no output in the Google Sheets.

Please help me out. Thank you so much!

Screenshot of the setup

Information on my n8n setup:

  • n8n version: 0.179.0
  • Database I’m using (default: SQLite): SQLite
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @miniduke, I am sorry to hear you’re having trouble. Unfortunately I couldn’t reproduce this on my end :frowning:

Is there a chance your email wasn’t seen by n8n at all and instead marked as read by some other email client?

Hi @MutedJam. Thanks for your reply. I create that Gmail address only to use at n8n and nowhere else. So I don’t think other mail client can mark it as read.
The strange part is that if the mail is marked as read, means the IMAP Email is working. But the payload is not transferred to the next node. The system did not throw any exception so I don’t know where to start looking… I’m thinking of using another email client such as Outlook to see if the issue persists.

Is your workflow active by any chance? If so, did you check the execution list to see if any data has been processed?

I have been having this same issue with the IMAP trigger using Gmail.

I have tried both activating the workflow with the on/off switch at the top right of the screen and manually activating with the Execute Workflow button at the bottom of the screen and the IMAP trigger does not execute, but the email state is changed from unread to read.

However the IMAP trigger works when it is triggered directly from the node.

@MutedJam Yes my workflow is active and there’s nothing in the execution list. I changed to Outlook and it seems to work fine. I’m continue watching it for now.

@MortgageRockstar For me, the Execute Workflow button works. I have to Mark As Unread all the required email, and press Execute Workflow, and everything runs normally.

Update:
I try to switch IMAP Email to Outlook but the problem still persists. When I receive the email, it is marked as read but the following actions are not running, thus there’s nothing to update in Google Sheets.

My n8n version: 0.180.0

Hey all, so I set up a test workflow for this, activated it and the execution appears in my execution list as expected:

Opening the execution data also show my email has been processed as expected:

This was on 0.181.2 though as I had upgraded yesterday. Could you try upgrading your n8n instances and confirm whether the behaviour still persists?

Alternatively you could switch to the designated Outlook/Gmail nodes to avoid IMAP shenanigans. I’ve shared an example workflow for Outlook earlier over here:

Hi @MutedJam

Thanks for the answer. Fact is that when I manually Execute Workflow, it still runs as normal. But what I expect is that whenever a new email is received, it should be process automatically via IMAP Email node.

However, looking at your example in the link, I understand that the param Operation: Get All means it will get all Unread emails, correct? If that’s the case, then I’ll try the work around and get back to you.

Thanks and best regards,

Hi @MutedJam
It seems like your answer is the solution. However, I can only use that with Outlook node, since only Outlook support the Update Email Status to Read. It’s a good workaround actually. Thank you so much for your time and support!
Best regards,

Hi @miniduke, sorry for the late reply. In Gmail you’d need to remove the UNREAD label for this to work, like so:

image

Getting this issue now, on version 0.225.2

Hi @OpenSourceSimon, perhaps you can open a new thread if you are facing any issues and provide all details required to reproduce your problem? This thread is from last year and is already marked as solved, so it’s easy to miss new messages here.

In general, if you’re using Gmail, I’d recommend avoiding the IMAP node and using the Gmail-specific nodes instead. These would use regular Google APIs and don’t require you to set up an application password or enable IMAP for a Google account. Microsoft has already announced that they are deprecating IMAP, and I wouldn’t be too surprised if Google did the same.

Hey @MutedJam, thanks for your reply! I’ve transformed to the Gmail node.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.