Class SimpleMessageBuilder

  • All Implemented Interfaces:
    MessageBuilder

    public final class SimpleMessageBuilder
    extends Object
    implements MessageBuilder
    Builder for MIME messages.
    The message builder is using the Session form SimpleMailService and the standard charset UTF-8.
    See Also:
    MimeMessage
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull MessageBuilder attachment​(byte @NotNull [] content, @NotNull String type, @NotNull String filename)
      Attaches the given content to the message.
      @NotNull MessageBuilder attachment​(byte @NotNull [] content, @NotNull String type, @NotNull String filename, @Nullable Collection<jakarta.mail.Header> headers)
      Attaches the given content with headers to the message.
      @NotNull MessageBuilder bcc​(@NotNull jakarta.mail.internet.InternetAddress bcc)
      Adds the given address to the list of blind carbon copy (bcc) recipients.
      @NotNull MessageBuilder bcc​(@NotNull jakarta.mail.internet.InternetAddress[] addresses)
      Adds the given addresses to the list of blind carbon copy (bcc) recipients.
      @NotNull MessageBuilder bcc​(@NotNull String address)
      Creates a new InternetAddress from given address and adds it to the list of blind carbon copy (bcc) recipients.
      @NotNull MessageBuilder bcc​(@NotNull String[] addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of blind carbon copy (bcc) recipients.
      @NotNull MessageBuilder bcc​(@NotNull String address, String name)
      Creates a new InternetAddress from given address and name and adds it to the list of blind carbon copy (bcc) recipients.
      @NotNull MessageBuilder bcc​(@NotNull Collection<String> addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of blind carbon copy (bcc) recipients.
      @NotNull jakarta.mail.internet.MimeMessage build()
      Builds the MIME message with the given input.
      @NotNull MessageBuilder cc​(@NotNull jakarta.mail.internet.InternetAddress cc)
      Adds the given address to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder cc​(@NotNull jakarta.mail.internet.InternetAddress[] addresses)
      Adds the given addresses to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder cc​(@NotNull String address)
      Creates a new InternetAddress from given address and adds it to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder cc​(@NotNull String[] addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder cc​(@NotNull String address, @NotNull String name)
      Creates a new InternetAddress from given address and name and adds it to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder cc​(@NotNull Collection<String> addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of carbon copy (cc) recipients.
      @NotNull MessageBuilder from​(@NotNull jakarta.mail.internet.InternetAddress from)
      Sets the given address for the RFC 822 From header field.
      @NotNull MessageBuilder from​(@NotNull String address)
      Creates a new InternetAddress from given address and sets it for the RFC 822 From header field.
      @NotNull MessageBuilder from​(@NotNull String address, @NotNull String name)
      Creates a new InternetAddress from given address and name and sets it for the RFC 822 From header field.
      @NotNull MessageBuilder header​(@NotNull String name, @Nullable String value)
      Creates a new header from given name and value and adds it to the list of headers.
      @NotNull MessageBuilder headers​(@NotNull Collection<jakarta.mail.Header> headers)
      Adds the given headers to the list of headers.
      @NotNull MessageBuilder html​(@NotNull String html)
      Sets the HTML content.
      @NotNull MessageBuilder inline​(byte @NotNull [] content, @NotNull String type, @NotNull String cid)
      Inlines the given content into the message.
      @NotNull MessageBuilder inline​(byte @NotNull [] content, @NotNull String type, @NotNull String cid, @Nullable Collection<jakarta.mail.Header> headers)
      Inlines the given content with headers into the message.
      @NotNull MessageBuilder replyTo​(@NotNull jakarta.mail.internet.InternetAddress replyTo)
      Adds the given address to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder replyTo​(@NotNull jakarta.mail.internet.InternetAddress[] addresses)
      Adds the given addresses to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder replyTo​(@NotNull String address)
      Creates a new InternetAddress from given address and adds it to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder replyTo​(@NotNull String[] addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder replyTo​(@NotNull String address, @NotNull String name)
      Creates a new InternetAddress from given address and name and adds it to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder replyTo​(@NotNull Collection<String> addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of addresses for the RFC 822 Reply-To header field.
      @NotNull MessageBuilder subject​(@NotNull String subject)
      Sets the given subject into the Subject header field.
      @NotNull MessageBuilder text​(@NotNull String text)
      Sets the plain text content.
      @NotNull MessageBuilder to​(@NotNull jakarta.mail.internet.InternetAddress to)
      Adds the given address to the list of primary (to) recipients.
      @NotNull MessageBuilder to​(@NotNull jakarta.mail.internet.InternetAddress[] addresses)
      Adds the given addresses to the list of primary (to) recipients.
      @NotNull MessageBuilder to​(@NotNull String address)
      Creates a new InternetAddress from given address and adds it to the list of primary (to) recipients.
      @NotNull MessageBuilder to​(@NotNull String[] addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of primary (to) recipients.
      @NotNull MessageBuilder to​(@NotNull String address, @NotNull String name)
      Creates a new InternetAddress from given address and name and adds it to the list of primary (to) recipients.
      @NotNull MessageBuilder to​(@NotNull Collection<String> addresses)
      Creates new InternetAddresses from given addresses and adds them to the list of primary (to) recipients.
    • Method Detail

      • header

        @NotNull
        public @NotNull MessageBuilder header​(@NotNull
                                              @NotNull String name,
                                              @Nullable
                                              @Nullable String value)
        Description copied from interface: MessageBuilder
        Creates a new header from given name and value and adds it to the list of headers.
        Specified by:
        header in interface MessageBuilder
        Parameters:
        name - the name of the header
        value - the value of the header
        Returns:
        the message builder
        See Also:
        Header, InternetHeaders
      • headers

        @NotNull
        public @NotNull MessageBuilder headers​(@NotNull
                                               @NotNull Collection<jakarta.mail.Header> headers)
        Description copied from interface: MessageBuilder
        Adds the given headers to the list of headers.
        Specified by:
        headers in interface MessageBuilder
        Parameters:
        headers - the headers to add
        Returns:
        the message builder
        See Also:
        Header, InternetHeaders
      • from

        @NotNull
        public @NotNull MessageBuilder from​(@NotNull
                                            @NotNull jakarta.mail.internet.InternetAddress from)
        Description copied from interface: MessageBuilder
        Sets the given address for the RFC 822 From header field.
        Specified by:
        from in interface MessageBuilder
        Parameters:
        from - the address
        Returns:
        the message builder
        See Also:
        MimeMessage.setFrom(Address)
      • from

        @NotNull
        public @NotNull MessageBuilder from​(@NotNull
                                            @NotNull String address)
                                     throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and sets it for the RFC 822 From header field.
        Specified by:
        from in interface MessageBuilder
        Parameters:
        address - the address
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setFrom(Address)
      • from

        @NotNull
        public @NotNull MessageBuilder from​(@NotNull
                                            @NotNull String address,
                                            @NotNull
                                            @NotNull String name)
                                     throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and name and sets it for the RFC 822 From header field.
        Specified by:
        from in interface MessageBuilder
        Parameters:
        address - the address
        name - the (personal) name
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setFrom(Address)
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull jakarta.mail.internet.InternetAddress to)
        Description copied from interface: MessageBuilder
        Adds the given address to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        to - the address
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull String address)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and adds it to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        address - the address
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull String address,
                                          @NotNull
                                          @NotNull String name)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and name and adds it to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        address - the address
        name - the (personal) name
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull jakarta.mail.internet.InternetAddress[] addresses)
        Description copied from interface: MessageBuilder
        Adds the given addresses to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull String[] addresses)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • to

        @NotNull
        public @NotNull MessageBuilder to​(@NotNull
                                          @NotNull Collection<String> addresses)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of primary (to) recipients.
        Specified by:
        to in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.TO
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull jakarta.mail.internet.InternetAddress cc)
        Description copied from interface: MessageBuilder
        Adds the given address to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        cc - the address
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull String address)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and adds it to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        address - the address
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull String address,
                                          @NotNull
                                          @NotNull String name)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and name and adds it to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        address - the address
        name - the (personal) name
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull jakarta.mail.internet.InternetAddress[] addresses)
        Description copied from interface: MessageBuilder
        Adds the given addresses to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull String[] addresses)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • cc

        @NotNull
        public @NotNull MessageBuilder cc​(@NotNull
                                          @NotNull Collection<String> addresses)
                                   throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of carbon copy (cc) recipients.
        Specified by:
        cc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.CC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull jakarta.mail.internet.InternetAddress bcc)
        Description copied from interface: MessageBuilder
        Adds the given address to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        bcc - the address
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull String address)
                                    throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and adds it to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        address - the address
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull String address,
                                           String name)
                                    throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and name and adds it to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        address - the address
        name - the (personal) name
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull jakarta.mail.internet.InternetAddress[] addresses)
        Description copied from interface: MessageBuilder
        Adds the given addresses to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull String[] addresses)
                                    throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • bcc

        @NotNull
        public @NotNull MessageBuilder bcc​(@NotNull
                                           @NotNull Collection<String> addresses)
                                    throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of blind carbon copy (bcc) recipients.
        Specified by:
        bcc in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setRecipients(RecipientType, Address[]), Message.RecipientType.BCC
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull jakarta.mail.internet.InternetAddress replyTo)
        Description copied from interface: MessageBuilder
        Adds the given address to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        replyTo - the address
        Returns:
        the message builder
        See Also:
        MimeMessage.setReplyTo(Address[])
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull String address)
                                        throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and adds it to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        address - the address
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setReplyTo(Address[])
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull String address,
                                               @NotNull
                                               @NotNull String name)
                                        throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates a new InternetAddress from given address and name and adds it to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        address - the address
        name - the (personal) name
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address string fails
        See Also:
        MimeMessage.setReplyTo(Address[])
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull jakarta.mail.internet.InternetAddress[] addresses)
        Description copied from interface: MessageBuilder
        Adds the given addresses to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        See Also:
        MimeMessage.setReplyTo(Address[])
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull String[] addresses)
                                        throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setReplyTo(Address[])
      • replyTo

        @NotNull
        public @NotNull MessageBuilder replyTo​(@NotNull
                                               @NotNull Collection<String> addresses)
                                        throws jakarta.mail.internet.AddressException
        Description copied from interface: MessageBuilder
        Creates new InternetAddresses from given addresses and adds them to the list of addresses for the RFC 822 Reply-To header field.
        Specified by:
        replyTo in interface MessageBuilder
        Parameters:
        addresses - the addresses
        Returns:
        the message builder
        Throws:
        jakarta.mail.internet.AddressException - if creating an InternetAddress from given address strings fails
        See Also:
        MimeMessage.setReplyTo(Address[])
      • subject

        @NotNull
        public @NotNull MessageBuilder subject​(@NotNull
                                               @NotNull String subject)
        Description copied from interface: MessageBuilder
        Sets the given subject into the Subject header field.
        Specified by:
        subject in interface MessageBuilder
        Parameters:
        subject - the subject of the message
        Returns:
        the message builder
        See Also:
        MimeMessage.setSubject(String)
      • text

        @NotNull
        public @NotNull MessageBuilder text​(@NotNull
                                            @NotNull String text)
        Description copied from interface: MessageBuilder
        Sets the plain text content.
        Specified by:
        text in interface MessageBuilder
        Parameters:
        text - the plain text content
        Returns:
        the message builder
        See Also:
        MimeMessage.setText(String, String), MimeBodyPart.setContent(Object, String)
      • html

        @NotNull
        public @NotNull MessageBuilder html​(@NotNull
                                            @NotNull String html)
        Description copied from interface: MessageBuilder
        Sets the HTML content.
        Specified by:
        html in interface MessageBuilder
        Parameters:
        html - the HTML content
        Returns:
        the message builder
        See Also:
        MimeBodyPart.setContent(Object, String)
      • attachment

        @NotNull
        public @NotNull MessageBuilder attachment​(byte @NotNull [] content,
                                                  @NotNull
                                                  @NotNull String type,
                                                  @NotNull
                                                  @NotNull String filename)
        Description copied from interface: MessageBuilder
        Attaches the given content to the message.
        Specified by:
        attachment in interface MessageBuilder
        Parameters:
        content - the content to attach
        type - the type of the content (content/media/MIME type)
        filename - the filename of the attachment
        Returns:
        the message builder
        See Also:
        Part.ATTACHMENT
      • attachment

        @NotNull
        public @NotNull MessageBuilder attachment​(byte @NotNull [] content,
                                                  @NotNull
                                                  @NotNull String type,
                                                  @NotNull
                                                  @NotNull String filename,
                                                  @Nullable
                                                  @Nullable Collection<jakarta.mail.Header> headers)
        Description copied from interface: MessageBuilder
        Attaches the given content with headers to the message.
        Specified by:
        attachment in interface MessageBuilder
        Parameters:
        content - the content to attach
        type - the type of the content (content/media/MIME type)
        filename - the filename of the attachment
        headers - the headers for the content
        Returns:
        the message builder
        See Also:
        Part.ATTACHMENT
      • inline

        @NotNull
        public @NotNull MessageBuilder inline​(byte @NotNull [] content,
                                              @NotNull
                                              @NotNull String type,
                                              @NotNull
                                              @NotNull String cid)
        Description copied from interface: MessageBuilder
        Inlines the given content into the message.
        Specified by:
        inline in interface MessageBuilder
        Parameters:
        content - the content to inline
        type - the type of the content (content/media/MIME type)
        cid - the content identifier (Content-ID)
        Returns:
        the message builder
        See Also:
        Part.INLINE
      • inline

        @NotNull
        public @NotNull MessageBuilder inline​(byte @NotNull [] content,
                                              @NotNull
                                              @NotNull String type,
                                              @NotNull
                                              @NotNull String cid,
                                              @Nullable
                                              @Nullable Collection<jakarta.mail.Header> headers)
        Description copied from interface: MessageBuilder
        Inlines the given content with headers into the message.
        Specified by:
        inline in interface MessageBuilder
        Parameters:
        content - the content to inline
        type - the type of the content (content/media/MIME type)
        cid - the content identifier (Content-ID)
        headers - the headers for the content
        Returns:
        the message builder
        See Also:
        Part.INLINE
      • build

        @NotNull
        public @NotNull jakarta.mail.internet.MimeMessage build()
                                                         throws jakarta.mail.MessagingException
        Description copied from interface: MessageBuilder
        Builds the MIME message with the given input.
        Specified by:
        build in interface MessageBuilder
        Returns:
        the built message
        Throws:
        jakarta.mail.MessagingException - if building message fails