Interface MailClient


public interface MailClient
SMTP mail client for Vert.x

A simple asynchronous API for sending mails from Vert.x applications

Author:
Alexander Lehmann
  • Field Details

  • Method Details

    • builder

      static MailClientBuilder builder(Vertx vertx)
      Provide a builder for MailClient.

      It can be used to configure advanced settings like changing credentials with MailClientBuilder.withCredentialsSupplier(Supplier).

    • create

      static MailClient create(Vertx vertx, MailConfig config)
      Create a non shared instance of the mail client.
      Parameters:
      vertx - the Vertx instance the operation will be run in
      config - MailConfig configuration to be used for sending mails
      Returns:
      MailClient instance that can then be used to send multiple mails
    • createShared

      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
      Parameters:
      vertx - the Vert.x instance
      config - the configuration
      poolName - the pool name
      Returns:
      the client
    • createShared

      static MailClient createShared(Vertx vertx, MailConfig config)
      Like createShared(io.vertx.core.Vertx, MailConfig, String) but with the default pool name
      Parameters:
      vertx - the Vert.x instance
      config - the configuration
      Returns:
      the client
    • sendMail

      Future<MailResult> sendMail(MailMessage email)
      send a single mail via MailClient
      Parameters:
      email - MailMessage object containing the mail text, from/to, attachments etc
      Returns:
      a future notified when the operation is finished or it fails (may be null to ignore the result)
    • close

      Future<Void> close()
      Close the MailClient