Class MailClient

java.lang.Object
io.vertx.mutiny.ext.mail.MailClient
All Implemented Interfaces:
MutinyDelegate

public class MailClient extends Object implements MutinyDelegate
SMTP mail client for Vert.x

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

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Alexander Lehmann
See Also:
  • MailClient
  • Field Details

  • Constructor Details

    • MailClient

      public MailClient(io.vertx.ext.mail.MailClient delegate)
      Create a new instance of MailClient delegating to the given (non-null) instance of MailClient.
    • MailClient

      public MailClient(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.mail.MailClient getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Returns:
      the delegate instance
    • sendMail

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.ext.mail.MailResult> sendMail(io.vertx.ext.mail.MailMessage email)
      send a single mail via MailClient

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Parameters:
      email - MailMessage object containing the mail text, from/to, attachments etc
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MailClient.sendMail(MailMessage)
    • sendMailAndAwait

      public io.vertx.ext.mail.MailResult sendMailAndAwait(io.vertx.ext.mail.MailMessage email)
      send a single mail via MailClient

      Unlike the bare Vert.x variant, this method returns a MailResult. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Parameters:
      email - MailMessage object containing the mail text, from/to, attachments etc
      Returns:
      The operation result
      See Also:
      • MailClient.sendMail(MailMessage)
    • sendMailAndForget

      public MailClient sendMailAndForget(io.vertx.ext.mail.MailMessage email)
      send a single mail via MailClient

      Unlike the bare Vert.x variant, this method ignores the MailResult result or any failure.

      Parameters:
      email - MailMessage object containing the mail text, from/to, attachments etc
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MailClient.sendMail(MailMessage)
    • close

      @CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
      Close the MailClient

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • MailClient.close()
    • closeAndAwait

      public void closeAndAwait()
      Close the MailClient

      Unlike the bare Vert.x variant, this method returns a Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      See Also:
      • MailClient.close()
    • closeAndForget

      public MailClient closeAndForget()
      Close the MailClient

      Unlike the bare Vert.x variant, this method ignores the Void result or any failure.

      Returns:
      The current instance to chain operations if needed.
      See Also:
      • MailClient.close()
    • builder

      public 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

      public static MailClient create(Vertx vertx, io.vertx.ext.mail.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

      public static MailClient createShared(Vertx vertx, io.vertx.ext.mail.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

      public static MailClient createShared(Vertx vertx, io.vertx.ext.mail.MailConfig config)
      Parameters:
      vertx - the Vert.x instance
      config - the configuration
      Returns:
      the client
    • newInstance

      public static MailClient newInstance(io.vertx.ext.mail.MailClient delegate)
      Creates a new instance of the MailClient.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object