public interface MailClient
A simple asynchronous API for sending mails from Vert.x applications
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_POOL_NAME
The name of the default pool
|
Modifier and Type | Method and Description |
---|---|
default Future<Void> |
close()
Same as
close(Handler) but returning a Future
|
void |
close(Handler<AsyncResult<Void>> closedHandler)
Close the MailClient
|
static MailClient |
create(Vertx vertx,
MailConfig config)
Create a non shared instance of the mail client.
|
static MailClient |
createShared(Vertx vertx,
MailConfig config)
Like
createShared(io.vertx.core.Vertx, MailConfig, String) but with the default pool name |
static MailClient |
createShared(Vertx vertx,
MailConfig config,
String poolName)
Create a Mail client which shares its connection pool with any other Mail clients created with the same
pool name
|
default Future<MailResult> |
sendMail(MailMessage email)
Same as
sendMail(MailMessage, Handler) but returning a Future. |
MailClient |
sendMail(MailMessage email,
Handler<AsyncResult<MailResult>> resultHandler)
send a single mail via MailClient
|
static final String DEFAULT_POOL_NAME
static MailClient create(Vertx vertx, MailConfig config)
vertx
- the Vertx instance the operation will be run inconfig
- MailConfig configuration to be used for sending mailsstatic MailClient createShared(Vertx vertx, MailConfig config, String poolName)
vertx
- the Vert.x instanceconfig
- the configurationpoolName
- the pool namestatic MailClient createShared(Vertx vertx, MailConfig config)
createShared(io.vertx.core.Vertx, MailConfig, String)
but with the default pool namevertx
- the Vert.x instanceconfig
- the configurationMailClient sendMail(MailMessage email, Handler<AsyncResult<MailResult>> resultHandler)
email
- MailMessage object containing the mail text, from/to, attachments etcresultHandler
- will be called when the operation is finished or it fails
(may be null to ignore the result)default Future<MailResult> sendMail(MailMessage email)
sendMail(MailMessage, Handler)
but returning a Future.
default Future<Void> close()
close(Handler)
but returning a Future
void close(Handler<AsyncResult<Void>> closedHandler)
closedHandler
- will be called after it is closed.Copyright © 2024 Eclipse. All rights reserved.