Class SMTPEnvelope
java.lang.Object
org.deltava.mail.SMTPEnvelope
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<NotificationEnvelope<?>>
,NotificationEnvelope<Address>
A bean to aggregate SMTP message information.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.deltava.beans.NotificationEnvelope
NotificationEnvelope.Protocol
-
Constructor Summary
ConstructorsConstructorDescriptionSMTPEnvelope
(boolean isOurDomain, EMailAddress from) Creates a new STMP envelope. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCopyTo
(EMailAddress addr) Adds an address to the copy-to list.void
Adds a header to the message.void
addRecipient
(EMailAddress addr) Adds an address to the recipient list.void
addRecipients
(Collection<EMailAddress> addrs) Adds a Collection of addresses to the recipient list.void
Clears the list of recipients.clone()
Clones this SMTP envelope.javax.activation.DataSource
Returns the envelope's attachment, if any.getBody()
Returns the message body.Returns the message content type.Address[]
Returns the copy-to recipient list.Returns the envelope creation date.Returns the destination address.getFrom()
Returns the originator of this e-mail message.Returns the message headers.Returns this envelope's notification protocol.Address[]
Returns the recipient list.Returns the message subject.int
hashCode()
boolean
Returns if the envelope has any recipients.boolean
Returns whether this envelope originates from our e-mail domain, or is spoofing another domain.void
setAttachment
(javax.activation.DataSource ds) Adds an attachment to the envelope.void
Sets the message body.void
setContentType
(String cType) Sets the message content type.void
setRecipient
(EMailAddress addr) Clears the recipient list and overwrites it with a single address.void
setSubject
(String subj) Sets the message subject.toString()
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.deltava.beans.NotificationEnvelope
compareTo
-
Constructor Details
-
SMTPEnvelope
SMTPEnvelope(boolean isOurDomain, EMailAddress from) Creates a new STMP envelope.- Parameters:
isOurDomain
- TRUE if from an SES-validated domain, otheriwse FALSEfrom
- the originating address
-
-
Method Details
-
getAttachment
public javax.activation.DataSource getAttachment()Returns the envelope's attachment, if any.- Returns:
- a Java Activation data source, or null
- See Also:
-
getBody
-
getCreatedOn
Description copied from interface:NotificationEnvelope
Returns the envelope creation date.- Specified by:
getCreatedOn
in interfaceNotificationEnvelope<Address>
- Returns:
- the creation date/time
-
getProtocol
Description copied from interface:NotificationEnvelope
Returns this envelope's notification protocol.- Specified by:
getProtocol
in interfaceNotificationEnvelope<Address>
- Returns:
- the Protocol
-
getSubject
-
getContentType
-
getFrom
Returns the originator of this e-mail message.- Returns:
- the originating address
-
getCopyTo
Returns the copy-to recipient list.- Returns:
- an array of Address beans, or null if empty
- See Also:
-
getRecipients
Returns the recipient list.- Returns:
- an array of Address beans
- See Also:
-
getEndpoint
Description copied from interface:NotificationEnvelope
Returns the destination address.- Specified by:
getEndpoint
in interfaceNotificationEnvelope<Address>
- Returns:
- the address
-
getHeaders
-
hasRecipients
public boolean hasRecipients()Returns if the envelope has any recipients.- Returns:
- TRUE if receipients or copyTo are not empty, otherwise FALSE
- See Also:
-
isOurDomain
public boolean isOurDomain()Returns whether this envelope originates from our e-mail domain, or is spoofing another domain.- Returns:
- TRUE if created using a validated SES domain, otherwise FALSE
-
setAttachment
public void setAttachment(javax.activation.DataSource ds) Adds an attachment to the envelope.- Parameters:
ds
- a Java Activation data source- See Also:
-
setBody
-
setSubject
Sets the message subject.- Parameters:
subj
- the subject- See Also:
-
setContentType
Sets the message content type.- Parameters:
cType
- the MIME type- See Also:
-
addRecipient
Adds an address to the recipient list.- Parameters:
addr
- the e-mail address- See Also:
-
addHeader
-
setRecipient
Clears the recipient list and overwrites it with a single address.- Parameters:
addr
- the e-mail address- See Also:
-
addRecipients
Adds a Collection of addresses to the recipient list.- Parameters:
addrs
- a Collection of EMailAddress beans- See Also:
-
addCopyTo
Adds an address to the copy-to list.- Parameters:
addr
- the e-mail address- See Also:
-
clearRecipients
public void clearRecipients()Clears the list of recipients. -
clone
-
hashCode
-
toString
-