Class DelegatingMail
java.lang.Object
ch.tocco.nice2.messaging.mail.spi.DelegatingMail
- Direct Known Subclasses:
IncaIncomeMail
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.tocco.nice2.messaging.mail.api.Mail
Mail.MailListener
-
Field Summary
Fields inherited from interface ch.tocco.nice2.messaging.mail.api.BaseMail
NO_SUBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachment
(Attachment attachment) Add the address from a User entity to "bcc".addBcc
(EntityList userEntities) Add addresses from User entities to "bcc".void
addBcc
(jakarta.mail.internet.InternetAddress address) void
Add addresses from a String to "bcc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"void
Add addresses from aList<String>
to "bcc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"Add the address from a User entity to "cc".addCc
(EntityList userEntities) Add addresses from User entities to "cc".void
addCc
(jakarta.mail.internet.InternetAddress address) void
Add addresses from a String to "cc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"void
Add addresses from a Listto "cc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"void
addMailListener
(Mail.MailListener listener) void
addReplyTo
(jakarta.mail.internet.InternetAddress address) void
addReplyTo
(String addresses) Add addresses from a String to "replyTo".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"void
addReplyTo
(List<String> addresses) Add addresses from aList<String>
to "replyTo".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"addSourceEntity
(@Nullable Entity sourceEntity) addTo
(MailReceiver receiver) Add a receiver to "to", evaluating the right value according to theMailReceiver
^s configuration.Add the address from a User entity to "to".addTo
(EntityList userEntities) Add addresses from User entities to "to".void
addTo
(jakarta.mail.internet.InternetAddress address) void
Add addresses from a String to "to".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addressesvoid
Add addresses from aList<String>
to "to".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addressesvoid
void
clearBcc()
void
clearCc()
void
void
clearTo()
clone()
boolean
containsAttachment
(Attachment attachment) createAttachment
(jakarta.activation.MimeType mimeType) createAttachment
(@Nullable String id, jakarta.activation.MimeType mimeType) createAttachment
(@Nullable String id, @Nullable String fileName, Binary binary) Adds the given attachment to this mail.List
<jakarta.mail.internet.InternetAddress> getBcc()
getBody()
List
<jakarta.mail.internet.InternetAddress> getCc()
@Nullable Entity
org.joda.time.LocalDate
jakarta.mail.internet.InternetAddress
getFrom()
@Nullable String
getHtml()
@Nullable Entity
@Nullable Entity
List
<jakarta.mail.internet.InternetAddress> @Nullable Entity
getTemplateAttribute
(String name) Get the value of a template attribute.Get an unmodifiable map of all template attributes.@Nullable Entity
@Nullable String
getText()
List
<jakarta.mail.internet.InternetAddress> getTo()
boolean
preventFromArchive
(boolean preventFromArchive) boolean
removeAttachment
(Attachment attachment) void
removeMailListener
(Mail.MailListener listener) void
send()
Send the message.setContactCategory
(@Nullable Entity contactCategory) setExpiryDate
(org.joda.time.LocalDate expiryDate) void
setFrom
(jakarta.mail.internet.InternetAddress from) void
setRecipientEntity
(@Nullable Entity recipientEntity) setRelatedEntity
(@Nullable Entity relatedEntity) setSingleCopyMail
(boolean singleCopyMail) only relevant for the GUI MailAction (defaults to false), won't link the resulting MailArchive entity to the recipient but the User(s) with the email address inBaseMail.getCc()
.setSourceEntity
(@Nullable Entity sourceEntity) void
setSubject
(@Nullable String subject) setTaskUuid
(UUID taskUuid) Set theUUID
which is needed to group the mails sent from the same tasksetTemplateAttribute
(String name, Object value) Set a template attribute.setTemplateEntity
(@Nullable Entity templateEntity) setTemplateEntityData
(String name, Entity entity) Set an entity template attributesetTemplateEntityListData
(String name, EntityList entityList) Set an entity list template attributevoid
-
Constructor Details
-
DelegatingMail
-
-
Method Details
-
getSubject
- Specified by:
getSubject
in interfaceBaseMail
-
setSubject
- Specified by:
setSubject
in interfaceBaseMail
-
getFrom
public jakarta.mail.internet.InternetAddress getFrom() -
setFrom
public void setFrom(jakarta.mail.internet.InternetAddress from) -
getTo
-
addTo
public void addTo(jakarta.mail.internet.InternetAddress address) -
addTo
Description copied from interface:BaseMail
Add addresses from aList<String>
to "to".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses -
addTo
Description copied from interface:BaseMail
Add addresses from a String to "to".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" This is only necessary if no recipient entity is set or if you want to add further addresses -
clearTo
public void clearTo() -
getCc
-
addCc
public void addCc(jakarta.mail.internet.InternetAddress address) -
addCc
Description copied from interface:BaseMail
Add addresses from a Listto "cc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" -
addCc
Description copied from interface:BaseMail
Add addresses from a String to "cc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" -
clearCc
public void clearCc() -
getBcc
-
addBcc
public void addBcc(jakarta.mail.internet.InternetAddress address) -
addBcc
Description copied from interface:BaseMail
Add addresses from aList<String>
to "bcc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" -
addBcc
Description copied from interface:BaseMail
Add addresses from a String to "bcc".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>" -
clearBcc
public void clearBcc() -
getReplyTo
- Specified by:
getReplyTo
in interfaceBaseMail
-
addReplyTo
public void addReplyTo(jakarta.mail.internet.InternetAddress address) - Specified by:
addReplyTo
in interfaceBaseMail
-
addReplyTo
Description copied from interface:BaseMail
Add addresses from a String to "replyTo".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"- Specified by:
addReplyTo
in interfaceBaseMail
- Parameters:
addresses
- String separated with "," or "\n"
-
addReplyTo
Description copied from interface:BaseMail
Add addresses from aList<String>
to "replyTo".
Can be either only email or email and name in format: "firstname lastname <email>.
example: "Hans Meier <hmeier@tocco.ch>"- Specified by:
addReplyTo
in interfaceBaseMail
- Parameters:
addresses
- List
-
clearReplyTo
public void clearReplyTo()- Specified by:
clearReplyTo
in interfaceBaseMail
-
getText
-
setText
-
getHtml
-
setHtml
-
getAttachments
- Specified by:
getAttachments
in interfaceBaseMail
-
clearAttachments
public void clearAttachments()- Specified by:
clearAttachments
in interfaceBaseMail
-
createAttachment
public Attachment createAttachment(@Nullable @Nullable String id, @Nullable @Nullable String fileName, Binary binary) Description copied from interface:BaseMail
Adds the given attachment to this mail. The content is taken from the given binary. The returned attachment is restricted in that it is not allowed to load new content using methodsAttachment.setContent(byte[])
,Attachment.loadContent(java.io.InputStream)
orAttachment.setMimeType(MimeType)
for setting the mime type- Specified by:
createAttachment
in interfaceBaseMail
- Parameters:
id
- optional id for this attachmentfileName
- optional name for this attachmentbinary
- the content
-
createAttachment
- Specified by:
createAttachment
in interfaceBaseMail
-
createAttachment
public Attachment createAttachment(@Nullable @Nullable String id, jakarta.activation.MimeType mimeType) - Specified by:
createAttachment
in interfaceBaseMail
-
addAttachment
- Specified by:
addAttachment
in interfaceBaseMail
-
getSourceEntity
- Specified by:
getSourceEntity
in interfaceMail
-
setSourceEntity
- Specified by:
setSourceEntity
in interfaceMail
-
addSourceEntity
- Specified by:
addSourceEntity
in interfaceMail
-
getRelatedEntity
- Specified by:
getRelatedEntity
in interfaceMail
-
setRelatedEntity
- Specified by:
setRelatedEntity
in interfaceMail
-
getRecipientEntity
- Specified by:
getRecipientEntity
in interfaceMail
-
setRecipientEntity
- Specified by:
setRecipientEntity
in interfaceMail
-
addTo
Description copied from interface:Mail
Add a receiver to "to", evaluating the right value according to theMailReceiver
^s configuration. -
addTo
Description copied from interface:Mail
Add the address from a User entity to "to". -
addTo
Description copied from interface:Mail
Add addresses from User entities to "to". -
addCc
Description copied from interface:Mail
Add the address from a User entity to "cc". -
addCc
Description copied from interface:Mail
Add addresses from User entities to "cc". -
addBcc
Description copied from interface:Mail
Add the address from a User entity to "bcc". -
addBcc
Description copied from interface:Mail
Add addresses from User entities to "bcc". -
getContactCategory
- Specified by:
getContactCategory
in interfaceMail
-
setContactCategory
- Specified by:
setContactCategory
in interfaceMail
-
getTemplateEntity
- Specified by:
getTemplateEntity
in interfaceMail
-
setTemplateEntity
- Specified by:
setTemplateEntity
in interfaceMail
-
preventFromArchive
- Specified by:
preventFromArchive
in interfaceMail
-
setTemplateAttribute
Description copied from interface:Mail
Set a template attribute. If an attribute with the same name already exists it will be overriden. To set entity data into a variable useMail.setTemplateEntityData(String, ch.tocco.nice2.persist.entity.Entity)
andMail.setTemplateEntityListData(String, ch.tocco.nice2.persist.entity.EntityList)
.- Specified by:
setTemplateAttribute
in interfaceMail
- Parameters:
name
- The name for the attribute.value
- The value.
-
setTemplateEntityData
Description copied from interface:Mail
Set an entity template attribute- Specified by:
setTemplateEntityData
in interfaceMail
- Parameters:
name
- the name for the attributeentity
- the entity
-
setTemplateEntityListData
Description copied from interface:Mail
Set an entity list template attribute- Specified by:
setTemplateEntityListData
in interfaceMail
- Parameters:
name
- the name for the attributeentityList
- the entity list
-
getTemplateAttribute
Description copied from interface:Mail
Get the value of a template attribute.- Specified by:
getTemplateAttribute
in interfaceMail
- Parameters:
name
- The name of the attribute to get.- Returns:
- the value or
Optional.empty()
if it's not set.
-
getTemplateAttributes
Description copied from interface:Mail
Get an unmodifiable map of all template attributes.- Specified by:
getTemplateAttributes
in interfaceMail
- Returns:
- an unmodifiable map of all attributes.
-
removeAttachment
- Specified by:
removeAttachment
in interfaceBaseMail
- Specified by:
removeAttachment
in interfaceMail
-
containsAttachment
- Specified by:
containsAttachment
in interfaceBaseMail
- Specified by:
containsAttachment
in interfaceMail
-
getAttributes
- Specified by:
getAttributes
in interfaceMail
-
send
Description copied from interface:Mail
Send the message.- Specified by:
send
in interfaceMail
- Throws:
MailException
-
clone
- Specified by:
clone
in interfaceMail
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
setFrom
-
getSender
-
setSender
-
setSingleCopyMail
Description copied from interface:Mail
only relevant for the GUI MailAction (defaults to false), won't link the resulting MailArchive entity to the recipient but the User(s) with the email address inBaseMail.getCc()
.- Specified by:
setSingleCopyMail
in interfaceMail
- Parameters:
singleCopyMail
- true / false
-
isSingleCopyMail
public boolean isSingleCopyMail()- Specified by:
isSingleCopyMail
in interfaceMail
-
getExpiryDate
public org.joda.time.LocalDate getExpiryDate()- Specified by:
getExpiryDate
in interfaceMail
-
setExpiryDate
- Specified by:
setExpiryDate
in interfaceMail
-
getTaskUuid
- Specified by:
getTaskUuid
in interfaceMail
-
setTaskUuid
Description copied from interface:Mail
Set theUUID
which is needed to group the mails sent from the same task- Specified by:
setTaskUuid
in interfaceMail
- Parameters:
taskUuid
- a random uuid given from the task which sends the mail
-
getBody
- Specified by:
getBody
in interfaceMail
- Throws:
MailException
-
getMimeMessageHeaders
public Map<String,Iterable<String>> getMimeMessageHeaders() throws MailException, jakarta.mail.MessagingException- Specified by:
getMimeMessageHeaders
in interfaceMail
- Throws:
MailException
jakarta.mail.MessagingException
-
getMimeMessageFrom
- Specified by:
getMimeMessageFrom
in interfaceMail
- Throws:
jakarta.mail.MessagingException
MailException
-
addMailListener
- Specified by:
addMailListener
in interfaceMail
-
removeMailListener
- Specified by:
removeMailListener
in interfaceMail
-