io.vertx.ext.mail.mailencoder

## Class MailEncoder

- java.lang.Object
- - io.vertx.ext.mail.mailencoder.MailEncoder

-     public class MailEncoder
      extends Object

  create MIME mail messages from a MailMessage object

  example usage is:

       MailMessage = new MailMessage();
       (set elements and attachments ...)
       String message = new MailEncoder(mailmessage).encode();

  usually you are not using this class directly, rather it will be used by `sendMail()` in MailClientImpl

  Author:
    Alexander Lehmann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MailEncoder(MailMessage message, String hostname)` create a MailEncoder for the message
    `MailEncoder(MailMessage message, String hostname, MailConfig mailConfig)` Creates a MailEncoder for the message.
    `MailEncoder(MailMessage message, String hostname, String userAgent)` create a MailEncoder for the message

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `encode()` encode the MailMessage to a String
    `EncodedPart` | `encodeMail()`
    `String` | `getMessageID()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MailEncoder

          public MailEncoder(MailMessage message,
                             String hostname)

      create a MailEncoder for the message

      The class will probably get a few setters for optional features of the SMTP protocol later e.g. 8BIT or SMTPUTF (this is not yet supported)

      Parameters:
        `message` - the message to encode later
        `hostname` - the hostname to be used in message-id or null to get hostname from OS network config

    - #### MailEncoder

          public MailEncoder(MailMessage message,
                             String hostname,
                             String userAgent)

      create a MailEncoder for the message

      The class will probably get a few setters for optional features of the SMTP protocol later e.g. 8BIT or SMTPUTF (this is not yet supported)

      Parameters:
        `message` - the message to encode later
        `hostname` - the hostname to be used in message-id or null to get hostname from OS network config
        `userAgent` - the Mail User Agent name used to generate the boundary and Message-ID

    - #### MailEncoder

          public MailEncoder(MailMessage message,
                             String hostname,
                             MailConfig mailConfig)

      Creates a MailEncoder for the message.
      Parameters:
        `message` - the message to encode later
        `hostname` - the hostname to be used in message-id or null to get hostname from OS network config
        `mailConfig` - the MailConfig used to encode the mail message

  - ### Method Detail

    - #### encode

          public String encode()

      encode the MailMessage to a String
      Returns:
        the encoded message

    - #### encodeMail

          public EncodedPart encodeMail()

    - #### getMessageID

          public String getMessageID()

      Returns:
        the messageId

Copyright © 2022 Eclipse. All rights reserved.