Class MailClient


  • public class MailClient
    extends Object
    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 using Vert.x codegen.

    • Constructor Detail

      • MailClient

        public MailClient​(io.vertx.ext.mail.MailClient delegate)
      • MailClient

        public MailClient​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.mail.MailClient getDelegate()
      • hashCode

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

        public static MailClient create​(Vertx vertx,
                                        io.vertx.ext.mail.MailConfig config)
        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)
        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
      • sendMail

        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. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        email - MailMessage object containing the mail text, from/to, attachments etc
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendMailAndAwait

        public io.vertx.ext.mail.MailResult sendMailAndAwait​(io.vertx.ext.mail.MailMessage email)
        Blocking variant of sendMail(MailMessage).

        This method waits 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 MailResult instance produced by the operation.
      • sendMailAndForget

        public MailClient sendMailAndForget​(io.vertx.ext.mail.MailMessage email)
        Variant of sendMail(MailMessage) that ignores the result of the operation.

        This method subscribes on the result of sendMail(MailMessage), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from sendMail(MailMessage) but you don't need to compose it with other operations.

        Parameters:
        email - MailMessage object containing the mail text, from/to, attachments etc
        Returns:
        the instance of MailClient to chain method calls.
      • close

        public void close()
      • newInstance

        public static MailClient newInstance​(io.vertx.ext.mail.MailClient arg)