Record Class EmailMessage

java.lang.Object
java.lang.Record
google.registry.util.EmailMessage
Record Components:
replyToEmailAddress - Optional return email address that overrides the default.

public record EmailMessage(String subject, String body, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> recipients, Optional<javax.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> bccs, Optional<com.google.common.net.MediaType> contentType, Optional<EmailMessage.Attachment> attachment) extends Record
Record representing the content and metadata of an email.

The sender address and display name are set by the email client and are not customizable by the user.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    An attachment to the email, if one exists.
    static interface 
    Builder for EmailMessage.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EmailMessage(String subject, String body, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> recipients, Optional<javax.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> bccs, Optional<com.google.common.net.MediaType> contentType, Optional<EmailMessage.Attachment> attachment)
    Creates an instance of a EmailMessage record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the attachment record component.
    com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress>
    Returns the value of the bccs record component.
    Returns the value of the body record component.
    com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress>
    ccs()
    Returns the value of the ccs record component.
    Optional<com.google.common.net.MediaType>
    Returns the value of the contentType record component.
    create(String subject, String body, javax.mail.internet.InternetAddress recipient)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
     
    com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress>
    Returns the value of the recipients record component.
    Optional<javax.mail.internet.InternetAddress>
    Returns the value of the replyToEmailAddress record component.
    Returns the value of the subject record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EmailMessage

      public EmailMessage(String subject, String body, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> recipients, Optional<javax.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> bccs, Optional<com.google.common.net.MediaType> contentType, Optional<EmailMessage.Attachment> attachment)
      Creates an instance of a EmailMessage record class.
      Parameters:
      subject - the value for the subject record component
      body - the value for the body record component
      recipients - the value for the recipients record component
      replyToEmailAddress - the value for the replyToEmailAddress record component
      ccs - the value for the ccs record component
      bccs - the value for the bccs record component
      contentType - the value for the contentType record component
      attachment - the value for the attachment record component
  • Method Details

    • newBuilder

      public static EmailMessage.Builder newBuilder()
    • create

      public static EmailMessage create(String subject, String body, javax.mail.internet.InternetAddress recipient)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • body

      public String body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • recipients

      public com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> recipients()
      Returns the value of the recipients record component.
      Returns:
      the value of the recipients record component
    • replyToEmailAddress

      public Optional<javax.mail.internet.InternetAddress> replyToEmailAddress()
      Returns the value of the replyToEmailAddress record component.
      Returns:
      the value of the replyToEmailAddress record component
    • ccs

      public com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> ccs()
      Returns the value of the ccs record component.
      Returns:
      the value of the ccs record component
    • bccs

      public com.google.common.collect.ImmutableSet<javax.mail.internet.InternetAddress> bccs()
      Returns the value of the bccs record component.
      Returns:
      the value of the bccs record component
    • contentType

      public Optional<com.google.common.net.MediaType> contentType()
      Returns the value of the contentType record component.
      Returns:
      the value of the contentType record component
    • attachment

      public Optional<EmailMessage.Attachment> attachment()
      Returns the value of the attachment record component.
      Returns:
      the value of the attachment record component