Package google.registry.util
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<jakarta.mail.internet.InternetAddress> recipients, Optional<jakarta.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<jakarta.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
Modifier and TypeClassDescriptionstatic final record
An attachment to the email, if one exists.static interface
Builder forEmailMessage
. -
Constructor Summary
ConstructorDescriptionEmailMessage
(String subject, String body, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> recipients, Optional<jakarta.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> bccs, Optional<com.google.common.net.MediaType> contentType, Optional<EmailMessage.Attachment> attachment) Creates an instance of aEmailMessage
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattachment
record component.com.google.common.collect.ImmutableSet
<jakarta.mail.internet.InternetAddress> bccs()
Returns the value of thebccs
record component.body()
Returns the value of thebody
record component.com.google.common.collect.ImmutableSet
<jakarta.mail.internet.InternetAddress> ccs()
Returns the value of theccs
record component.Optional
<com.google.common.net.MediaType> Returns the value of thecontentType
record component.static EmailMessage
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static EmailMessage.Builder
com.google.common.collect.ImmutableSet
<jakarta.mail.internet.InternetAddress> Returns the value of therecipients
record component.Optional
<jakarta.mail.internet.InternetAddress> Returns the value of thereplyToEmailAddress
record component.subject()
Returns the value of thesubject
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
EmailMessage
public EmailMessage(String subject, String body, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> recipients, Optional<jakarta.mail.internet.InternetAddress> replyToEmailAddress, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> ccs, com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> bccs, Optional<com.google.common.net.MediaType> contentType, Optional<EmailMessage.Attachment> attachment) Creates an instance of aEmailMessage
record class.- Parameters:
subject
- the value for thesubject
record componentbody
- the value for thebody
record componentrecipients
- the value for therecipients
record componentreplyToEmailAddress
- the value for thereplyToEmailAddress
record componentccs
- the value for theccs
record componentbccs
- the value for thebccs
record componentcontentType
- the value for thecontentType
record componentattachment
- the value for theattachment
record component
-
-
Method Details
-
newBuilder
-
create
public static EmailMessage create(String subject, String body, jakarta.mail.internet.InternetAddress recipient) -
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
subject
Returns the value of thesubject
record component.- Returns:
- the value of the
subject
record component
-
body
Returns the value of thebody
record component.- Returns:
- the value of the
body
record component
-
recipients
public com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> recipients()Returns the value of therecipients
record component.- Returns:
- the value of the
recipients
record component
-
replyToEmailAddress
Returns the value of thereplyToEmailAddress
record component.- Returns:
- the value of the
replyToEmailAddress
record component
-
ccs
public com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> ccs()Returns the value of theccs
record component.- Returns:
- the value of the
ccs
record component
-
bccs
public com.google.common.collect.ImmutableSet<jakarta.mail.internet.InternetAddress> bccs()Returns the value of thebccs
record component.- Returns:
- the value of the
bccs
record component
-
contentType
Returns the value of thecontentType
record component.- Returns:
- the value of the
contentType
record component
-
attachment
Returns the value of theattachment
record component.- Returns:
- the value of the
attachment
record component
-