Class Mailers
java.lang.Object
com.codename1.backend.mail.Mailers
Opens the Mailer a configuration names, and finds the one of the calling
thread's server.
| Setting | Default | |
|---|---|---|
cn1.mail.url |
memory: |
smtp://host:587, smtps://host:465, ses://region, log:, memory: |
cn1.mail.from |
the sender of a mail that names none: Shop <no-reply@example.com> |
|
cn1.mail.domain |
the sender's | the domain a Message-ID is made in |
cn1.mail.username, cn1.mail.password |
credentials, when the URL carries none | |
cn1.mail.retry.max-attempts |
6 | attempts before a mail is given up on |
cn1.mail.retry.backoff |
30000 | milliseconds before the second attempt |
cn1.mail.retry.multiplier |
4 | what each later wait is multiplied by |
cn1.mail.retry.max-backoff |
3600000 | the longest wait |
cn1.mail.outbox.sweep |
10000 | milliseconds between looks for mails a stopped server left |
Each transport documents its own settings. Without cn1.mail.url, Spring
Boot's spring.mail.host selects SMTP, with spring.mail.port,
spring.mail.username and spring.mail.password.
A transport is compiled into an application only when its configuration
names it: the build registers that one transport's factory with
register(String, Mailers.TransportFactory), so SMTP adds nothing to an application that sends through an
API, and neither adds anything to one that sends no mail.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceOpens a transport for a URL of its scheme. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbindDataSource(DataSource dataSource) Gives the calling thread's server's mail support its data source, where the outbox is kept.static Mailercurrent()The mail support of the calling thread's server: opened from its configuration the first time it is asked for, closed when the server stops.static booleanisConfigured(Config config) Whetherconfignames a transport that sends.static Maileropen(Config config, DataSource dataSource) Opens the mail supportconfignames; the caller closes it.static voidregister(String scheme, Mailers.TransportFactory factory) Makesscheme(smtp,ses) open throughfactory.static StringThe URLconfignames, or null when it names none.
-
Method Details
-
register
Makesscheme(smtp,ses) open throughfactory. Called by the generated wiring, never by application code. -
bindDataSource
Gives the calling thread's server's mail support its data source, where the outbox is kept. Called by the generated wiring before any bean can send.- Throws:
IOException
-
current
The mail support of the calling thread's server: opened from its configuration the first time it is asked for, closed when the server stops.- Throws:
IOException
-
isConfigured
Whetherconfignames a transport that sends.- Throws:
IOException
-
url
The URLconfignames, or null when it names none.- Throws:
IOException
-
open
Opens the mail support
confignames; the caller closes it.dataSource: the server's, or null; where the outbox is kept
- Throws:
IOException
-