Shapes

Start a flow

When an email arrives

Starts the flow for new mail in an IMAP mailbox, Gmail or Outlook, with each message as a record and its attachments as files.

Nodes › TriggersOpen in Neblex
Good for
Mail-driven work
Role
Starts a flow
Find it in
Nodes › Triggers

When to use it

  • Invoices, orders or requests arrive by email.
  • Attachments should be read, filed or passed on.
  • Handled mail should be marked read or moved to another folder.

Reach for something else when

Example

Every five minutes, take unread invoices from the Invoices folder, read the attached PDF, file it and move the message to Processed.

  1. When an email arrives
  2. Read document
  3. AI task
  4. Google Drive

How it works

Settings
Mailbox type: IMAP (any mail server), Gmail or Microsoft Outlook; Mailbox: the connection to it; Folder [the inbox]: an IMAP folder, a Gmail label ID or an Outlook folder (a well-known name such as inbox or archive, or a folder ID); Only unread mail [off]; After pickup: leave the message as it is, mark it read, or move it to another folder [leave it]; Move to (when moving): an IMAP folder, a Gmail label ID (the message leaves the folder that was read) or an Outlook folder; Check for new mail: how often, like a schedule.
Behaviour
The first check only notes where the mailbox stands, so turning the flow on never replays old mail. After that each check starts a run with the messages that arrived since the last one, oldest first, a page at a time. Each record has subject, from, to, cc (each a list of {name, email}), date, message_id, text, html, attachments (each with filename, contentType, size and the file in content_base64), raw (the whole message as an .eml file), folder and the message's id (IMAP: uid). A message too large to read in memory arrives as its raw file. Marking read or moving happens only once the run with the message has started safely; if it fails, the message stays where it is and the run still has it. With Records per run set, the messages are split into runs of that size. Gmail starts again from the current mail if it was not checked for about a week.
Example
Every five minutes, take unread invoices from the Invoices folder, read the attached PDF and file it, then move the message to Processed.
More in the guide

Add it to a flow

  1. Open the flow from Build › Workflows.
  2. Open Nodes and find When an email arrives under Triggers. Drag it onto the canvas as the first step.
  3. Connect it to the next step and open its settings with ✎ Edit.
  4. Save and test with Run, then set the flow Active so it starts on its own.