Skip to main content

Gmail and mailboxes

A mailbox connection lets Lumen read a mailbox that already exists, so a new email there can start a flow with no forwarding rule and no change to your mail settings. Gmail, Yahoo, iCloud and any company mail server that speaks IMAP connect the same way.

  • 10 minutes
  • Needs an app password
  • Admin to connect

How Gmail connects​

Gmail connects as a Mailbox (IMAP) connection, signed in with a Google app password. There is no "Sign in with Google" button: a native Gmail connection with Google sign-in is planned and not available yet.

If you have a Microsoft 365 or Outlook mailbox, use Microsoft 365 instead. Microsoft has largely retired password sign-in over IMAP, so Lumen offers an approval-based connection for it.

Reading or forwarding​

Email forwardingMailbox (IMAP)
How mail reaches LumenYou add a rule that forwards a copy to a Lumen address. It arrives the moment it is sent.Lumen signs in to the mailbox and checks it every few minutes (5 by default).
What you changeA forwarding rule in your mail.Nothing in your mail settings, but you give Lumen a password.
What Lumen can seeOnly what you forward.The folder you point a flow at.
Best forA shared address, or when you cannot give out a password.A mailbox you cannot add rules to.

See Email forwarding for the first one.

Connect a mailbox​

Create an app password first. Google does not accept your normal password over IMAP.

  1. In your Google account, turn on 2-Step Verification.
  2. Open App passwords and create one named Lumen. Google shows 16 letters. Spaces are fine.
  3. In a Google Workspace account, an admin must allow app passwords first.

Then connect it. Yahoo and iCloud work the same way with their own app passwords (an iCloud one keeps its dashes).

  1. In the sidebar, open Connectors, click Add connection and choose Mailbox (IMAP).
  2. Give it a Name, such as Accounting inbox.
  3. Under Server, enter imap.gmail.com. Leave Port at 993 and Encryption at TLS (recommended).
  4. Under User name, enter the full address. Under Password, paste the app password.
  5. Click Test connection. Lumen signs in and lists the mailbox's folders. Then click Add Mailbox (IMAP).
The Add connection panel for Mailbox (IMAP). Name holds Accounting inbox. Server holds imap.gmail.com. Port is 993. Encryption offers TLS (recommended, selected), STARTTLS and None (development only). User name holds accounting@example.com. Skip certificate check is switched off. Password is filled with hidden characters. Test connection, Cancel and Add Mailbox (IMAP) are at the bottom.The Add connection panel for Mailbox (IMAP). Name holds Accounting inbox. Server holds imap.gmail.com. Port is 993. Encryption offers TLS (recommended, selected), STARTTLS and None (development only). User name holds accounting@example.com. Skip certificate check is switched off. Password is filled with hidden characters. Test connection, Cancel and Add Mailbox (IMAP) are at the bottom.
The mailbox form. The password is kept apart from the connection and never shown again.

Skip certificate check and the None encryption choice are for development. With either on, anyone on the network could read the mail or pose as your server, and the console warns you.

If the test fails, the message says why: the mailbox refused the user name or password (for Gmail, Yahoo and iCloud that usually means a normal password was used), the server could not be reached, the secure connection failed, or the server did not answer in time.

Start a flow from new mail​

Add the trigger An email arrives, set Source to Your mailbox, and pick the mailbox under Which mailbox starts this flow?.

The settings of the trigger An email arrives in a mailbox. Source is set to Your mailbox. Which mailbox starts this flow shows office@example.com, Mailbox (IMAP). Folder to watch shows the placeholder INBOX. After the flow has the email offers Mark it as read (selected), Move it to a folder and Leave it as it is. Check every (minutes) is 5 and Include attachments is switched on.The settings of the trigger An email arrives in a mailbox. Source is set to Your mailbox. Which mailbox starts this flow shows office@example.com, Mailbox (IMAP). Folder to watch shows the placeholder INBOX. After the flow has the email offers Mark it as read (selected), Move it to a folder and Leave it as it is. Check every (minutes) is 5 and Include attachments is switched on.
The same trigger as for forwarded mail, with Your mailbox as the source.
SettingDefaultWhat it does
Folder to watch (folder)INBOXThe mailbox folder to read. Pick one from the connection's folders, or type a name.
After the flow has the email (afterHandling)Mark it as readMark it as read, Move it to a folder, or Leave it as it is.
Check every (minutes) (pollMinutes)5How often Lumen looks, 1 to 60.
Include attachments (includeAttachments)OnTake the message's files.
Attachments (attachments)Each attachment separately for a new triggerOne document per file, or The whole email as one.
Largest mail (MB) (maxSizeMB)25A bigger message is recorded and not downloaded. 1 to 40.
Only emails with an attachment (requireAttachment)OffA mailbox trigger takes every message unless you turn this on.
Import existing mails (newest) (importExisting)0Also take the newest N messages already in the folder, once, when the trigger is first switched on. 0 to 500.
Start only when (when)NoneA condition on the email's own fields. A message that does not match starts no run and is left in the mailbox, not marked read or moved.

The trigger gives the same fields as a forwarded email: from, to, subject, body, attachments, senderVerified, receivedAt and messageId. A reply or forward step after it works the same way. How attachments become documents is described in Email forwarding, and the limits there apply here, with Largest mail (MB) going up to 40.

mailbox-invoices.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: mailbox-invoices
namespace: tenant-acme
spec:
displayName: File invoices from the accounting inbox
triggers:
- id: email
ref: {name: mailbox-email}
connectorRef: {name: accounting-inbox}
config:
folder: INBOX
afterHandling: {mode: moveTo, folder: Processed}
pollMinutes: 5
attachments: separate
requireAttachment: true
when: {field: email.subject, op: contains, value: invoice}
next: [pdfs]
nodes:
- id: pdfs
stepRef: {name: keep-pdfs}
next: [keep]
- id: keep
stepRef: {name: save-file}
config: {destination: lumen, folder: "Invoices/{date:yyyy-MM}"}

In YAML the trigger for this source is mailbox-email. The console shows it as An email arrives with Source set to Your mailbox, and a flow saved either way runs the same.

How checking works​

  • A new trigger starts from now. Mail already in the folder is not touched unless you set Import existing mails (newest).
  • At most 50 messages per check. A bigger backlog is worked off over the next checks.
  • Each message starts one run per flow, once. Lumen remembers the Message-ID, so a message is never handled twice by the same flow, even when a check repeats.
  • Check now. In the trigger's Recent emails, an admin can click Check the mailbox now to read it at once instead of waiting. A second request within 30 seconds is refused.
  • When the mailbox cannot be read, Lumen retries with a growing delay (up to 30 minutes), marks the connection Not working with the reason (the mailbox cannot be reached, it refused the sign-in, or the folder is missing), and tells the workspace's admins once. It clears the warning when the mailbox reads again. Editing the connection triggers a retry at once.
  • Sender verification. senderVerified comes from the authentication header your mail server added when it received the message. Gmail, Microsoft 365 and Exchange Online add one. A server that does not leaves the result only as good as the header the sender wrote.

What Lumen can do in your mailbox​

An IMAP password cannot be limited to part of a mailbox. Whoever holds it has the mailbox's full IMAP access, so treat the app password like a key, and revoke it in your Google account if you disconnect.

What Lumen does with it:

  • It reads the folders a flow watches, and the messages that arrive in them.
  • After a flow takes a message it marks it as read, moves it, or leaves it, as you chose.
  • It does not delete mail, and it does not send mail through IMAP. A flow's Send it to me by email step sends from Lumen's own address. To send as the mailbox itself, use Microsoft 365.

Lumen stores the password apart from the connection, uses it only when it checks the mailbox, and never shows it again.

Next steps​