Class Body

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class Body
    extends Object
    implements Serializable, Cloneable

    Represents the body of the message. You can specify text, HTML, or both. If you use both, then the message should display correctly in the widest variety of email clients.

    See Also:
    Serialized Form
    • Constructor Detail

      • Body

        public Body()
        Default constructor for Body object. Callers should use the setter or fluent setter (with...) methods to initialize the object after creating it.
      • Body

        public Body​(Content text)
        Constructs a new Body object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.
        Parameters:
        text - The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
    • Method Detail

      • setText

        public void setText​(Content text)

        The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).

        Parameters:
        text - The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
      • getText

        public Content getText()

        The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).

        Returns:
        The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
      • withText

        public Body withText​(Content text)

        The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).

        Parameters:
        text - The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setHtml

        public void setHtml​(Content html)

        The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.

        Parameters:
        html - The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
      • getHtml

        public Content getHtml()

        The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.

        Returns:
        The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
      • withHtml

        public Body withHtml​(Content html)

        The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.

        Parameters:
        html - The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • toString

        public String toString()
        Returns a string representation of this object; useful for testing and debugging.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this object.
        See Also:
        Object.toString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object