EmailReadImap stuck when on itself (active), works fine when executed by hand

Hi team,

First, thank you for this great piece of software. I come from Huginn. It took a little time to get used to it, but once I could “master” some examples, I could get some fun out of it.

Today I’m stuck, though.

I’m testing for the first time the EmailReadImap node. It works fine (credentials, parsing data…) when executed by hand (in the editor). But when left on it own in active mode, it doesn’t pass the hand to the next node (set + send email…).

I know it runs because the email gets “read” status.

Environment:

  • self-hosted
  • installed with npm
  • using SSL
  • hosted mail server

I could use some advice if you have any clue.

Cheers,

Hubert

Welcome to the community @codysys0

Glad that you liked the project.

How do you know the EmailReadImap is triggered when the workflow is activated? Are you checking the executions and examining the workflow? If not, you can do that. That seems quite strange. The only thing I can think of it’s the node before the set node is not returning data. Do you have another node between the EmailReadImap and the Set node? If you share your workflow, I can have a better look. You select all nodes in the workflow, copy them, and paste them here to do so.

Hi Ricardo,

Thanks for taking the time to answer.

I know the code is trigerred because the email I’ve sent to test is “read” without me accessing it.

No other node between the EmailReadImap node and the set node. And even though, if there was a problem in the workflow, it would not work executed by hand. So, I have no idea.

As for seeing the executions, it appears only when executed by hand.


{
  "nodes": [
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "from",
              "value": "={{$node[\"IMAP Email\"].json[\"from\"]}}"
            },
            {
              "name": "to",
              "value": "={{$node[\"IMAP Email\"].json[\"to\"]}}"
            },
            {
              "name": "subject",
              "value": "={{$node[\"IMAP Email\"].json[\"subject\"]}}"
            },
            {
              "name": "text",
              "value": "={{$node[\"IMAP Email\"].json[\"textPlain\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        300,
        250
      ]
    },
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        100,
        100
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "IMAP Email",
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 1,
      "position": [
        100,
        250
      ],
      "credentials": {
        "imap": "IMAP01"
      }
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "={{$json[\"from\"]}}",
        "subject": "RETOUR TEST",
        "text": "RETOUR TEST",
        "options": {
          "allowUnauthorizedCerts": true
        }
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        500,
        250
      ],
      "credentials": {
        "smtp": "SMTP01"
      }
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "from",
              "value": "={{$node[\"IMAP Email\"].json[\"from\"]}}"
            },
            {
              "name": "to",
              "value": "={{$node[\"IMAP Email\"].json[\"to\"]}}"
            },
            {
              "name": "subject",
              "value": "={{$node[\"IMAP Email\"].json[\"subject\"]}}"
            },
            {
              "name": "text",
              "value": "={{$node[\"IMAP Email\"].json[\"textPlain\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        300,
        250
      ]
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IMAP Email": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hi @codysys0

Welcome to our community!

I suggest you open your workflow and on its settings, set the “Save Execution Progress” feature to Yes.

Then I would ask you to test the workflow again, open the execution history (in the left menu) and maybe posting a screenshot of the latest execution, so we can see how far the workflow progressed.

1 Like

Hi @krynble

Thanks for your time.

How weird. It doesn’t show anything in “Workflow Executions”. No more than before. Still, the email is changed from “unread” to “read”.

Also I’ve retried manually and it works fine, but doesn’t show in “Workflow Executions”. AaaHa…

RESOLVED (for now):
I delete the workflow, created a new one and pasted it. It works both manually and in the background.
No idea why.
Still doesn’t show in “Workflow Executions”.

Hey @codysys0!

Did you enable the settings to save manual, successful, and failed executions? To save manually executions, you will have to configure it. n8n doesn’t save manual executions by default.

Hi @codysys0

Glad it’s working but you should be seeing the executions’ history update as n8n runs the workflows.

One important clarification that I think is needed: once you activate the workflow, it will connect to your mailbox and only new messages received from that point on will trigger workflows, so you would have to email yourself after activating the workflow to have it executing.

Also as Harshil mentioned, you can enable saving manual executions too so you can see all executions on your log.

Hi @harshil1712, thanks

You are right. I forgot. It does appear now in “Workflow Executions”. It didn’t in the previous “version” of it even though I had activated it.

Cheers

1 Like

@krynble, that is what I did (email myself only after activating the workflow). Still it didn’t work (go to the end of the workflow). But it did start as the new email was “read”.
I have no idea why now. I just made a copy paste.

1 Like

Thank to all of you for your time.

1 Like