Package com.onec.mail
Record Class MailMessage
java.lang.Object
java.lang.Record
com.onec.mail.MailMessage
public record MailMessage(String from, String replyTo, List<String> to, List<String> cc, List<String> bcc, String subject, String text, String html, List<MailAttachment> attachments, List<MailHeader> headers)
extends Record
Provider-agnostic outbound mail message. Built via
builder().
Body may be plain text or HTML; if HTML is set it takes precedence.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattachmentsrecord component.bcc()Returns the value of thebccrecord component.static MailMessage.Builderbuilder()cc()Returns the value of theccrecord component.final booleanIndicates whether some other object is "equal to" this one.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.html()Returns the value of thehtmlrecord component.booleanisHtml()replyTo()Returns the value of thereplyTorecord component.subject()Returns the value of thesubjectrecord component.text()Returns the value of thetextrecord component.to()Returns the value of thetorecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MailMessage
public MailMessage(String from, String replyTo, List<String> to, List<String> cc, List<String> bcc, String subject, String text, String html, List<MailAttachment> attachments, List<MailHeader> headers) Creates an instance of aMailMessagerecord class.- Parameters:
from- the value for thefromrecord componentreplyTo- the value for thereplyTorecord componentto- the value for thetorecord componentcc- the value for theccrecord componentbcc- the value for thebccrecord componentsubject- the value for thesubjectrecord componenttext- the value for thetextrecord componenthtml- the value for thehtmlrecord componentattachments- the value for theattachmentsrecord componentheaders- the value for theheadersrecord component
-
-
Method Details
-
isHtml
public boolean isHtml() -
builder
-
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). -
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
replyTo
Returns the value of thereplyTorecord component.- Returns:
- the value of the
replyTorecord component
-
to
Returns the value of thetorecord component.- Returns:
- the value of the
torecord component
-
cc
Returns the value of theccrecord component.- Returns:
- the value of the
ccrecord component
-
bcc
Returns the value of thebccrecord component.- Returns:
- the value of the
bccrecord component
-
subject
Returns the value of thesubjectrecord component.- Returns:
- the value of the
subjectrecord component
-
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
html
Returns the value of thehtmlrecord component.- Returns:
- the value of the
htmlrecord component
-
attachments
Returns the value of theattachmentsrecord component.- Returns:
- the value of the
attachmentsrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-