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.
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 forwarding | Mailbox (IMAP) | |
|---|---|---|
| How mail reaches Lumen | You 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 change | A forwarding rule in your mail. | Nothing in your mail settings, but you give Lumen a password. |
| What Lumen can see | Only what you forward. | The folder you point a flow at. |
| Best for | A 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.
- In your Google account, turn on 2-Step Verification.
- Open App passwords and create one named
Lumen. Google shows 16 letters. Spaces are fine. - 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).
- Console
- CLI
- YAML
- In the sidebar, open Connectors, click Add connection and choose Mailbox (IMAP).
- Give it a Name, such as
Accounting inbox. - Under Server, enter
imap.gmail.com. Leave Port at993and Encryption at TLS (recommended). - Under User name, enter the full address. Under Password, paste the app password.
- Click Test connection. Lumen signs in and lists the mailbox's folders. Then click Add Mailbox (IMAP).
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.
lumen connect imap-mailbox accounting-inbox --preset gmail \
--set username=accounting@example.com \
--secret-env password=GMAIL_APP_PASSWORD
--preset gmail fills in the server, port and encryption and shows Google's app password guide. Presets also exist for yahoo, icloud and other. Run it with no flags and it asks for each value, with the password hidden. Secrets are never taken as a flag value.
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
name: accounting-inbox
namespace: tenant-acme
spec:
classRef: {name: imap-mailbox}
config:
host: imap.gmail.com
port: 993
security: tls
username: accounting@example.com
credentials:
secretRef: {name: lumen-conn-accounting-inbox}
The password is a Kubernetes Secret in the workspace's namespace, named lumen-conn-accounting-inbox, with one key, password. Never put it in the resource. Writing it through the console or lumen connect creates the Secret for 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?.
| Setting | Default | What it does |
|---|---|---|
Folder to watch (folder) | INBOX | The 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 read | Mark it as read, Move it to a folder, or Leave it as it is. |
Check every (minutes) (pollMinutes) | 5 | How often Lumen looks, 1 to 60. |
Include attachments (includeAttachments) | On | Take the message's files. |
Attachments (attachments) | Each attachment separately for a new trigger | One document per file, or The whole email as one. |
Largest mail (MB) (maxSizeMB) | 25 | A bigger message is recorded and not downloaded. 1 to 40. |
Only emails with an attachment (requireAttachment) | Off | A mailbox trigger takes every message unless you turn this on. |
Import existing mails (newest) (importExisting) | 0 | Also take the newest N messages already in the folder, once, when the trigger is first switched on. 0 to 500. |
Start only when (when) | None | A 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.
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.
senderVerifiedcomes 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.

