IMAP Email as a Trigger: The Universal Interface for Legacy Software

IMAP as a universal interface: how the n8n Email Trigger integrates legacy software into modern workflows without an API.

Many companies still run software somewhere in the background that has no concept of webhooks, offers no REST API, and never will. The inventory management system from the early 2010s, the fax gateway that sends emails from a form, or the supplier who sends order confirmations exclusively as an email attachment. For exactly these cases, IMAP is the quiet bridge that almost every system can somehow handle, because email has been the lowest common denominator of IT for decades.

n8n comes with its own trigger node for this, the Email Trigger (IMAP). It connects to an IMAP mailbox, checks it for new messages, and automatically starts a workflow with every new email. This turns a mailbox into a universal interface: anything that can somehow send an email, no matter how old or proprietary the system behind it is, can pass data to n8n through it. This article shows how the trigger works, which settings really matter, and what you should watch out for during operation and troubleshooting.

Why IMAP is often the only realistic connection

Modern automation usually thinks in terms of webhooks and REST endpoints. But a large part of the software actually running in companies was built before such interfaces became standard. Point-of-sale systems, machine controllers, government portals, old ERP installations: many of them can send emails but cannot serve an API. For this legacy software, IMAP often remains the only practical way to process events automatically.

The charm of this solution lies in its simplicity. You don't need developer access, no firewall opening for incoming webhooks, and no coordination with a software vendor who may no longer maintain the product. Setting up a mailbox and entering its address as the recipient in the legacy software is usually enough. n8n takes care of the rest: it watches the mailbox and reacts to every new message, just as it would react to a webhook.

How the Email Trigger (IMAP) basically works

The node Email Trigger (IMAP) is, according to official documentation, a trigger node that receives emails via an IMAP server and ensures that every newly arriving message triggers a workflow run. The basic configuration includes the following points:

  • Credential: a stored IMAP credential connection through which n8n logs into the mailbox.
  • Mailbox Name: the folder from which messages should be retrieved, usually the inbox.
  • Action: determines what happens to a processed email. "None" leaves it unread, "Mark as Read" marks it as read after retrieval.
  • Download Attachments: controls whether attachments are also downloaded. Since this can noticeably slow down processing, you should only enable this option if the workflow actually needs the attachments.

For the output format, the documentation distinguishes three variants. Simple delivers the complete email but is not recommended for embedded attachments. Resolved delivers the email with all resolved data and stores attachments as binary data, which is the most practical choice for most automations. RAW returns the complete raw message including the body as a base64url encoded string in the raw field, useful when a downstream system needs to process the original email unchanged.

Advanced options: filter rules and stable connections

In addition to the basic settings, the node offers additional options that make a difference in rough everyday operation. With Custom Email Rules you can define your own search criteria based on the search function of the underlying node-imap library. This lets you, for example, trigger only on emails from a specific sender or with a specific subject, instead of processing every incoming message in the mailbox.

The option Force Reconnect Every Minutes ensures that the connection to the IMAP server is rebuilt at a fixed interval. Especially for mailboxes that remain inactive for a long time or whose server-side IMAP sessions are disconnected on their own, this prevents the trigger from unnoticedly "falling asleep" and no longer registering new emails. If you notice in practice that messages are sporadically not detected, a regular reconnect is usually the first sensible thing to adjust.

Setting up the IMAP credentials correctly

Before the trigger can run at all, it needs a working credential connection. According to the IMAP credential documentation, the following information is required for this:

  • User: the email address of the mailbox to be queried.
  • Password: either the regular password or an app password, depending on what the respective provider requires.
  • Host: the IMAP server address, usually in the form imap.provider.com.
  • Port: 993 by default, unless the provider specifies otherwise.
  • SSL/TLS: should remain enabled for an encrypted connection.
  • Allow Self-Signed Certificates: only relevant if you operate your own mail server with a self-signed certificate.

The documentation explicitly points out that the respective provider determines whether the normal account password or a separate app password must be used. For Gmail, Yahoo Mail, and Outlook.com, n8n provides its own quick start guides that explain exactly this distinction. Important for legacy software scenarios: ideally set up a dedicated mailbox used exclusively for automation instead of integrating a personal account. This way you retain control over which messages actually trigger the workflow, and you can manage the mailbox independently of individual employees.

Typical structure of an IMAP based workflow

In practice, such a workflow usually looks like this:

  • The legacy software sends an automated email, for example an order confirmation, an error report, or an exported dataset as an attachment.
  • The Email Trigger (IMAP) detects the new message in the monitored mailbox and starts the workflow.
  • A downstream node, often a code node or a specialized parser, reads out subject, sender, text, or attachment and converts the data into a structured format.
  • The processed data then flows on into a modern system, for example into a CRM, a spreadsheet, or a ticketing system.

This chain works regardless of how old or closed the original software is, as long as it can send emails at all. This is exactly what makes IMAP a foundational building block that you keep finding in many automation projects, even though modern API integrations are generally preferable whenever they are available.

Limits and pitfalls in operation

As reliable as IMAP is as a bridge, it remains a polling query and not a genuine push event. n8n checks the mailbox at intervals, not in real time, which is why there is always a small delay between an email arriving and the workflow starting. For most legacy software scenarios this is uncritical, but for time critical processes you should plan for this from the outset.

Another point is mailbox hygiene. If emails remain permanently in the monitored folder, the mailbox grows uncontrolled, and depending on the provider this can slow down the query. It is advisable to move processed messages to an archive folder via a downstream step, or to use Custom Email Rules to specifically fetch only the actually relevant messages. And finally: attachments, subject lines, and sender addresses from legacy software are rarely as cleanly formatted as a modern API response. Plan for enough error handling in processing so that an unexpected format does not block the entire workflow.

Frequently asked questions

Can I also process attachments automatically with the Email Trigger (IMAP)?

Yes, to do this you enable the Download Attachments option and best select Resolved as the format, so attachments are available as binary data in the workflow. Since downloading attachments can slow down processing, you should only enable this option when needed, especially if many or large files are expected.

Does the trigger react immediately to new emails?

The trigger queries the mailbox at recurring intervals instead of using a genuine push notification from the mail server. In practice the delay is usually small, but for truly time critical use cases you should take this into account and, if necessary, test how quickly your specific setup actually reacts.

What do I do if the trigger stops detecting new emails after some time?

In this case it is worth first looking at the Force Reconnect Every Minutes option. A permanently open IMAP connection can be disconnected server side without n8n noticing immediately; a regular forced reconnection reliably fixes this problem in many cases.

Do I need a separate mailbox for every piece of legacy software?

Strictly necessary, no, but in practice a dedicated, clearly separated mailbox per use case has proven effective. With Custom Email Rules you can also filter by sender or subject within a shared mailbox, but a separate mailbox makes later troubleshooting and access management significantly easier.

Is an app password always required for the IMAP credentials?

This depends on the respective email provider. For Gmail, Yahoo Mail, and Outlook.com, the providers generally require a separate app password instead of the normal account password, while a self hosted mail server often works with the regular password. When in doubt, the respective provider itself specifies which variant to use.

About NordFlux

NordFlux UG (haftungsbeschränkt)

NordFlux builds digital employees for organisations: automations and AI agents that take over repetitive work. You stay in control.

More about us
Free initial analysis

Concrete questions about automation or AI?

In a free initial analysis we discuss your case directly. No strings attached.