Skip to content

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.

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: false
PropertyTypeRequiredDefaultDescription
protocol"imap" | "pop3"YesMail retrieval protocol.
hoststringYesMail server hostname.
portintNo993 (IMAP) / 995 (POP3)Server port. Defaults depend on protocol.
tlsboolNotrueEnable TLS/SSL for the connection.
authobjectYesCredentials (username and password).
poll_intervaldurationNo60sHow often to check for new messages.
folderstringNoINBOXMailbox folder to poll. IMAP only.
filterstringNoIMAP search string to filter messages (e.g. UNSEEN, SUBJECT "Lab"). IMAP only.
read_attachmentsboolNofalseExtract file attachments and include them in the message payload.
delete_after_readboolNofalseDelete messages from the server after successful processing.

An IMAP source that polls for lab result emails and extracts PDF attachments:

channels/lab-email-intake/channel.yaml
id: lab-email-intake
enabled: true
group: 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