
Email RealTimeTrigger
CertifiedTrigger Flow on real-time emails
Email RealTimeTrigger
Trigger Flow on real-time emails
Listens to a mailbox and creates one execution per email. IMAP uses IDLE for push-style delivery; POP3 falls back to polling on interval (default PT60S) with SSL enabled by default—relax TLS checks only when required. Use MailReceivedTrigger instead when batching multiple emails.
type: io.kestra.plugin.email.RealTimeTriggerExamples
Monitor Gmail inbox for new emails in real-time
id: realtime_email_monitor
namespace: company.team
tasks:
- id: process_email
type: io.kestra.plugin.core.log.Log
message: |
Real-time email received:
Subject: {{ trigger.subject }}
From: {{ trigger.from }}
Date: {{ trigger.date }}
Body: {{ trigger.body }}
{% if trigger.attachments is not empty %}First attachment: {{ trigger.attachments[0].uri }}{% endif %}
triggers:
- id: realtime_gmail_trigger
type: io.kestra.plugin.email.RealTimeTrigger
protocol: IMAP
host: imap.gmail.com
port: 993
username: "{{ secret('GMAIL_USERNAME') }}"
password: "{{ secret('GMAIL_PASSWORD') }}"
folder: INBOX
ssl: true
Monitor POP3 mailbox in real-time
id: realtime_pop3_monitor
namespace: company.team
triggers:
- id: realtime_pop3_trigger
type: io.kestra.plugin.email.RealTimeTrigger
protocol: POP3
host: pop.example.com
port: 995
username: "{{ secret('EMAIL_USERNAME') }}"
password: "{{ secret('EMAIL_PASSWORD') }}"
ssl: true
interval: PT30S
Properties
host *Requiredstring
Mail server host
Hostname or IP address for the mailbox connection
password *Requiredstring
Password
Password or secret for mailbox authentication
username *Requiredstring
Username
Username used to authenticate against the mailbox
allowConcurrent Non-dynamicboolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
folder string
INBOXMail folder
Folder to monitor (IMAP only). Defaults to INBOX
interval string
PT1MCheck interval
Frequency for polling-based checks as an ISO-8601 duration. Default PT60S
maxAttachmentSize integerstring
26214400Maximum attachment size
Maximum size in bytes of a single attachment stored in internal storage. Larger attachments keep their metadata but get a null uri. Default 26214400 (25MB)
port integerstring
Mail server port
Override the connection port. Defaults: IMAP 993/143, POP3 995/110 depending on SSL
protocol string
IMAPIMAPPOP3Choose mail protocol
Protocol used to connect to the mailbox (IMAP or POP3). Defaults to IMAP
ssl booleanstring
trueUse SSL/TLS
Enable TLS for the mailbox connection. Defaults to true
stopAfter Non-dynamicarray
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
trustAllCertificates booleanstring
falseTrust all certificates
Skip TLS certificate and hostname validation (testing only). WARNING: this disables protection against man-in-the-middle attacks and must never be enabled in production. Defaults to false
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
attachments array
Email attachments
Metadata describing each attachment
io.kestra.plugin.email.MailService-AttachmentInfo
Content type
Attachment MIME type reported by the sender
Attachment filename
Name as provided by the sender. Can be null when the sender did not provide one
File size in bytes
Attachment size when provided by the server
uriAttachment URI
URI of the attachment stored in Kestra internal storage
bcc array
BCC email addresses
Addresses from the BCC header when available
body string
Email body content
Text content extracted from the message parts
cc array
CC email addresses
Addresses from the CC header
date string
date-timeEmail date
Message date as parsed from Received or Sent headers
from string
Sender email address
Address from the From header
messageId string
Message ID
Unique message identifier from the email headers
subject string
Email subject
Subject line of the received email
to array
Recipient email addresses
Addresses from the To header