Email Source
The Email source connects to a mail server using IMAP or POP3 and polls for new messages on a configurable interval. Message bodies and, optionally, attachments are extracted and passed into the channel pipeline.
This is well suited for workflows where external systems deliver reports, lab results, or documents via email — common in healthcare environments where email remains a primary transport.
Configuration
Section titled “Configuration”source: type: email protocol: imap host: mail.hospital.org port: 993 tls: true auth: username: lab-intake@hospital.org password: ${EMAIL_PASSWORD} poll_interval: 60s folder: INBOX filter: "UNSEEN SUBJECT \"Lab Result\"" read_attachments: true delete_after_read: falseProperties
Section titled “Properties”| Property | Type | Required | Default | Description |
|---|---|---|---|---|
protocol | "imap" | "pop3" | Yes | — | Mail retrieval protocol. |
host | string | Yes | — | Mail server hostname. |
port | int | No | 993 (IMAP) / 995 (POP3) | Server port. Defaults depend on protocol. |
tls | bool | No | true | Enable TLS/SSL for the connection. |
auth | object | Yes | — | Credentials (username and password). |
poll_interval | duration | No | 60s | How often to check for new messages. |
folder | string | No | INBOX | Mailbox folder to poll. IMAP only. |
filter | string | No | — | IMAP search string to filter messages (e.g. UNSEEN, SUBJECT "Lab"). IMAP only. |
read_attachments | bool | No | false | Extract file attachments and include them in the message payload. |
delete_after_read | bool | No | false | Delete messages from the server after successful processing. |
Complete Example
Section titled “Complete Example”An IMAP source that polls for lab result emails and extracts PDF attachments:
id: lab-email-intakeenabled: truegroup: laboratory
source: type: email protocol: imap host: mail.hospital.org port: 993 tls: true auth: username: lab-results@hospital.org password: ${LAB_EMAIL_PASSWORD} poll_interval: 30s folder: INBOX filter: "UNSEEN FROM \"analyzer@labcorp.com\"" read_attachments: true delete_after_read: false
transformer: lab-attachment-to-fhir.ts
destinations: - ehr_fhir - archive