Record Class EmailChannelConfig
- Record Components:
imapHost- IMAP server hostname (e.g.imap.gmail.com)imapPort- IMAP port (993 for IMAPS, 143 for STARTTLS)imapUser- IMAP login usernameimapPassword- IMAP login password (app-password for Gmail/iCloud)imapSsl- whether to use SSL/TLS (true for 993, false for 143)imapFolder- mailbox to poll, defaults toINBOXsmtpHost- SMTP server hostnamesmtpPort- SMTP port (587 for STARTTLS, 465 for SMTPS)smtpUser- SMTP login usernamesmtpPassword- SMTP login passwordsmtpStartTls- whether to issue STARTTLS on SMTP (true for 587)fromAddress- theFromheader on outbound mail (typically equalssmtpUserbut Reply-To tricks make this a separate field)senderAllowlist- addresses that are allowed to reach the agent; comparison is case-insensitivepollInterval- how often the channel polls IMAP for new mail
EmailChannel.
Values are typically populated from environment variables via
fromEnvironment(); programmatic overrides via the builder are
intended for tests and per-tenant deployments.
The senderAllowlist is matched against the inbound
From address (lowercased via Locale.ROOT) — every
email not on the list is silently dropped before reaching the agent.
This is intentional: email is the most spammable channel and a blank
allowlist means "process nothing".
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault IMAPS port.static final DurationDefault poll interval — 60 seconds, per TNS-354 acceptance ("5 minute response").static final intDefault SMTP+STARTTLS port. -
Constructor Summary
ConstructorsConstructorDescriptionEmailChannelConfig(String imapHost, int imapPort, String imapUser, String imapPassword, boolean imapSsl, String imapFolder, String smtpHost, int smtpPort, String smtpUser, String smtpPassword, boolean smtpStartTls, String fromAddress, Set<String> senderAllowlist, Duration pollInterval) Creates an instance of aEmailChannelConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefromAddressrecord component.static Optional<EmailChannelConfig> Populate from environment variables.final inthashCode()Returns a hash code value for this object.Returns the value of theimapFolderrecord component.imapHost()Returns the value of theimapHostrecord component.Returns the value of theimapPasswordrecord component.intimapPort()Returns the value of theimapPortrecord component.booleanimapSsl()Returns the value of theimapSslrecord component.imapUser()Returns the value of theimapUserrecord component.booleantruewhen the From address is on the allowlist.Returns the value of thepollIntervalrecord component.Returns the value of thesenderAllowlistrecord component.smtpHost()Returns the value of thesmtpHostrecord component.Returns the value of thesmtpPasswordrecord component.intsmtpPort()Returns the value of thesmtpPortrecord component.booleanReturns the value of thesmtpStartTlsrecord component.smtpUser()Returns the value of thesmtpUserrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_POLL_INTERVAL
Default poll interval — 60 seconds, per TNS-354 acceptance ("5 minute response"). -
DEFAULT_IMAP_PORT
public static final int DEFAULT_IMAP_PORTDefault IMAPS port.- See Also:
-
DEFAULT_SMTP_PORT
public static final int DEFAULT_SMTP_PORTDefault SMTP+STARTTLS port.- See Also:
-
-
Constructor Details
-
EmailChannelConfig
public EmailChannelConfig(String imapHost, int imapPort, String imapUser, String imapPassword, boolean imapSsl, String imapFolder, String smtpHost, int smtpPort, String smtpUser, String smtpPassword, boolean smtpStartTls, String fromAddress, Set<String> senderAllowlist, Duration pollInterval) Creates an instance of aEmailChannelConfigrecord class.- Parameters:
imapHost- the value for theimapHostrecord componentimapPort- the value for theimapPortrecord componentimapUser- the value for theimapUserrecord componentimapPassword- the value for theimapPasswordrecord componentimapSsl- the value for theimapSslrecord componentimapFolder- the value for theimapFolderrecord componentsmtpHost- the value for thesmtpHostrecord componentsmtpPort- the value for thesmtpPortrecord componentsmtpUser- the value for thesmtpUserrecord componentsmtpPassword- the value for thesmtpPasswordrecord componentsmtpStartTls- the value for thesmtpStartTlsrecord componentfromAddress- the value for thefromAddressrecord componentsenderAllowlist- the value for thesenderAllowlistrecord componentpollInterval- the value for thepollIntervalrecord component
-
-
Method Details
-
isAllowed
truewhen the From address is on the allowlist. -
fromEnvironment
Populate from environment variables. Missing required vars returnOptional.empty()so the channel can decline to start without raising an exception.Recognised vars:
EMAIL_IMAP_HOST,EMAIL_IMAP_PORT,EMAIL_IMAP_USER,EMAIL_IMAP_PASSWORD,EMAIL_IMAP_SSL,EMAIL_IMAP_FOLDER,EMAIL_SMTP_HOST,EMAIL_SMTP_PORT,EMAIL_SMTP_USER,EMAIL_SMTP_PASSWORD,EMAIL_SMTP_STARTTLS,EMAIL_FROM_ADDRESS,EMAIL_SENDER_ALLOWLIST(comma-separated),EMAIL_POLL_INTERVAL_SECONDS. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
imapHost
Returns the value of theimapHostrecord component.- Returns:
- the value of the
imapHostrecord component
-
imapPort
public int imapPort()Returns the value of theimapPortrecord component.- Returns:
- the value of the
imapPortrecord component
-
imapUser
Returns the value of theimapUserrecord component.- Returns:
- the value of the
imapUserrecord component
-
imapPassword
Returns the value of theimapPasswordrecord component.- Returns:
- the value of the
imapPasswordrecord component
-
imapSsl
public boolean imapSsl()Returns the value of theimapSslrecord component.- Returns:
- the value of the
imapSslrecord component
-
imapFolder
Returns the value of theimapFolderrecord component.- Returns:
- the value of the
imapFolderrecord component
-
smtpHost
Returns the value of thesmtpHostrecord component.- Returns:
- the value of the
smtpHostrecord component
-
smtpPort
public int smtpPort()Returns the value of thesmtpPortrecord component.- Returns:
- the value of the
smtpPortrecord component
-
smtpUser
Returns the value of thesmtpUserrecord component.- Returns:
- the value of the
smtpUserrecord component
-
smtpPassword
Returns the value of thesmtpPasswordrecord component.- Returns:
- the value of the
smtpPasswordrecord component
-
smtpStartTls
public boolean smtpStartTls()Returns the value of thesmtpStartTlsrecord component.- Returns:
- the value of the
smtpStartTlsrecord component
-
fromAddress
Returns the value of thefromAddressrecord component.- Returns:
- the value of the
fromAddressrecord component
-
senderAllowlist
Returns the value of thesenderAllowlistrecord component.- Returns:
- the value of the
senderAllowlistrecord component
-
pollInterval
Returns the value of thepollIntervalrecord component.- Returns:
- the value of the
pollIntervalrecord component
-