SMTP/IMAP Email
SMTP/IMAP Email connects your flow to an email account through the standard email protocols, the ones almost every provider and company mail server offers. With it you can send emails, attachments included, or read the emails received in a folder.
Use it when your email account has no dedicated component in NappAI, or when you prefer to connect with the mailbox’s username and password.
When to use it
- Send a customer an email with the quote the flow has prepared.
- Read the unread emails in the support mailbox every hour and classify them with an agent.
- Collect the attachments of incoming emails, such as PDF invoices, and extract their text.
- Email the team when the flow detects something that needs attention.
Configuration
The component needs an SMTP / IMAP credential with the sending and reading servers, their ports, and the account’s username and password. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The credential of the email account. |
| Operation | What you want to do: Send Email or Get Emails (read emails). Default: Send Email. The fields below change with the operation. |
Send Email
| Field | What it does |
|---|---|
| Recipient(s) | The recipient’s address. For several, separate them with commas. |
| Subject | The email subject. |
| Body | The email text. If you write the body with web formatting, it is sent with that formatting. |
| Attachments | Optional. Connect the files you want to attach. |
Get Emails
| Field | What it does |
|---|---|
| Limit | How many of the most recent emails are read. Default: 10. |
| Folder | The mailbox folder to read. Default: INBOX. |
| Search Criteria | Which emails are read: ALL, UNSEEN (unread), SEEN (read), ANSWERED, FLAGGED, DELETED (marked for deletion) or DRAFT. Default: UNSEEN. |
| Mark as Read | Marks the emails it reads as read. Off by default. |
Advanced options for Get Emails:
| Field | What it does |
|---|---|
| Fetch Attachments | Downloads the attachments of the emails. |
| Process Attachments | Requires Fetch Attachments. Extracts the text of the attachments that allow it, such as PDFs or Word documents. |
| Enable OCR | Requires Fetch Attachments and Process Attachments. Also reads the text shown in image attachments. |
Output
The Data output depends on the operation:
- Send Email: a message confirming who the email was sent to.
- Get Emails: one item per email, with its text, subject, sender, date and, if you download them, the attachments with their content.
You can connect the emails read to an agent to classify or answer them, or to Parse Data to turn them into text. The component can also be used as a tool by an agent.
Example
A shop wants to sort the emails that reach its customer service mailbox:
- Add SMTP/IMAP Email, pick the credential and choose Get Emails in Operation.
- Leave Search Criteria on UNSEEN and turn on Mark as Read so the same email is not read twice.
- Connect Data to an agent that decides whether each email is a return, a question or a complaint.
- Schedule the flow every hour from the Scheduler.
Good practices
- The port in the credential decides how the connection is secured: SMTP on 465 uses TLS from the start and other ports (587, 25) switch to TLS when the server offers it; IMAP on 993 uses TLS and 143 switches to TLS when the server offers it.
- If your email provider asks for it, use an app password in the credential instead of the account’s usual password.
- Combine UNSEEN with Mark as Read when the flow runs periodically.
- Turn on Process Attachments only when you need the text of the attachments: reading them takes longer.