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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachment(Attachment attachment) Add the address from a User entity to "bcc".addBcc(EntityList userEntities) Add addresses from User entities to "bcc".voidaddBcc(jakarta.mail.internet.InternetAddress address) voidAdd 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>"voidAdd 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".voidaddCc(jakarta.mail.internet.InternetAddress address) voidAdd 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>"voidAdd 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>"voidaddMailListener(Mail.MailListener listener) voidaddReplyTo(jakarta.mail.internet.InternetAddress address) voidaddReplyTo(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>"voidaddReplyTo(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".voidaddTo(jakarta.mail.internet.InternetAddress address) voidAdd 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 addressesvoidAdd 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 addressesvoidvoidclearBcc()voidclearCc()voidvoidclearTo()clone()booleancontainsAttachment(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 Entityorg.joda.time.LocalDatejakarta.mail.internet.InternetAddressgetFrom()@Nullable StringgetHtml()@Nullable Entity@Nullable EntityList<jakarta.mail.internet.InternetAddress> @Nullable EntitygetTemplateAttribute(String name) Get the value of a template attribute.Get an unmodifiable map of all template attributes.@Nullable Entity@Nullable StringgetText()List<jakarta.mail.internet.InternetAddress> getTo()booleanbooleanbooleanpreventFromArchive(boolean preventFromArchive) booleanremoveAttachment(Attachment attachment) voidremoveMailListener(Mail.MailListener listener) voidsend()Send the message.setContactCategory(@Nullable Entity contactCategory) setExpiryDate(org.joda.time.LocalDate expiryDate) voidsetFrom(jakarta.mail.internet.InternetAddress from) voidsetRecipientEntity(@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) voidsetSubject(@Nullable String subject) setTaskUuid(UUID taskUuid) Set theUUIDwhich 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:
getSubjectin interfaceBaseMail
-
setSubject
- Specified by:
setSubjectin 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:BaseMailAdd 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:BaseMailAdd 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:BaseMailAdd 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:BaseMailAdd 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:BaseMailAdd 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:BaseMailAdd 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() -
hasNoRecipients
public boolean hasNoRecipients()- Specified by:
hasNoRecipientsin interfaceBaseMail
-
getReplyTo
- Specified by:
getReplyToin interfaceBaseMail
-
addReplyTo
public void addReplyTo(jakarta.mail.internet.InternetAddress address) - Specified by:
addReplyToin interfaceBaseMail
-
addReplyTo
Description copied from interface:BaseMailAdd 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:
addReplyToin interfaceBaseMail- Parameters:
addresses- String separated with "," or "\n"
-
addReplyTo
Description copied from interface:BaseMailAdd 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:
addReplyToin interfaceBaseMail- Parameters:
addresses- List
-
clearReplyTo
public void clearReplyTo()- Specified by:
clearReplyToin interfaceBaseMail
-
getText
-
setText
-
getHtml
-
setHtml
-
isBodyEmpty
public boolean isBodyEmpty()- Specified by:
isBodyEmptyin interfaceBaseMail
-
getAttachments
- Specified by:
getAttachmentsin interfaceBaseMail
-
clearAttachments
public void clearAttachments()- Specified by:
clearAttachmentsin interfaceBaseMail
-
createAttachment
public Attachment createAttachment(@Nullable @Nullable String id, @Nullable @Nullable String fileName, Binary binary) Description copied from interface:BaseMailAdds 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:
createAttachmentin interfaceBaseMail- Parameters:
id- optional id for this attachmentfileName- optional name for this attachmentbinary- the content
-
createAttachment
- Specified by:
createAttachmentin interfaceBaseMail
-
createAttachment
public Attachment createAttachment(@Nullable @Nullable String id, jakarta.activation.MimeType mimeType) - Specified by:
createAttachmentin interfaceBaseMail
-
addAttachment
- Specified by:
addAttachmentin interfaceBaseMail
-
getSourceEntity
- Specified by:
getSourceEntityin interfaceMail
-
setSourceEntity
- Specified by:
setSourceEntityin interfaceMail
-
addSourceEntity
- Specified by:
addSourceEntityin interfaceMail
-
getRelatedEntity
- Specified by:
getRelatedEntityin interfaceMail
-
setRelatedEntity
- Specified by:
setRelatedEntityin interfaceMail
-
getRecipientEntity
- Specified by:
getRecipientEntityin interfaceMail
-
setRecipientEntity
- Specified by:
setRecipientEntityin interfaceMail
-
addTo
Description copied from interface:MailAdd a receiver to "to", evaluating the right value according to theMailReceiver^s configuration. -
addTo
Description copied from interface:MailAdd the address from a User entity to "to". -
addTo
Description copied from interface:MailAdd addresses from User entities to "to". -
addCc
Description copied from interface:MailAdd the address from a User entity to "cc". -
addCc
Description copied from interface:MailAdd addresses from User entities to "cc". -
addBcc
Description copied from interface:MailAdd the address from a User entity to "bcc". -
addBcc
Description copied from interface:MailAdd addresses from User entities to "bcc". -
getContactCategory
- Specified by:
getContactCategoryin interfaceMail
-
setContactCategory
- Specified by:
setContactCategoryin interfaceMail
-
getTemplateEntity
- Specified by:
getTemplateEntityin interfaceMail
-
setTemplateEntity
- Specified by:
setTemplateEntityin interfaceMail
-
preventFromArchive
- Specified by:
preventFromArchivein interfaceMail
-
setTemplateAttribute
Description copied from interface:MailSet 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:
setTemplateAttributein interfaceMail- Parameters:
name- The name for the attribute.value- The value.
-
setTemplateEntityData
Description copied from interface:MailSet an entity template attribute- Specified by:
setTemplateEntityDatain interfaceMail- Parameters:
name- the name for the attributeentity- the entity
-
setTemplateEntityListData
Description copied from interface:MailSet an entity list template attribute- Specified by:
setTemplateEntityListDatain interfaceMail- Parameters:
name- the name for the attributeentityList- the entity list
-
getTemplateAttribute
Description copied from interface:MailGet the value of a template attribute.- Specified by:
getTemplateAttributein 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:MailGet an unmodifiable map of all template attributes.- Specified by:
getTemplateAttributesin interfaceMail- Returns:
- an unmodifiable map of all attributes.
-
removeAttachment
- Specified by:
removeAttachmentin interfaceBaseMail- Specified by:
removeAttachmentin interfaceMail
-
containsAttachment
- Specified by:
containsAttachmentin interfaceBaseMail- Specified by:
containsAttachmentin interfaceMail
-
getAttributes
- Specified by:
getAttributesin interfaceMail
-
send
Description copied from interface:MailSend the message.- Specified by:
sendin interfaceMail- Throws:
MailException
-
clone
- Specified by:
clonein interfaceMail- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
setFrom
-
getSender
-
setSender
-
setSingleCopyMail
Description copied from interface:Mailonly 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:
setSingleCopyMailin interfaceMail- Parameters:
singleCopyMail- true / false
-
isSingleCopyMail
public boolean isSingleCopyMail()- Specified by:
isSingleCopyMailin interfaceMail
-
getExpiryDate
public org.joda.time.LocalDate getExpiryDate()- Specified by:
getExpiryDatein interfaceMail
-
setExpiryDate
- Specified by:
setExpiryDatein interfaceMail
-
getTaskUuid
- Specified by:
getTaskUuidin interfaceMail
-
setTaskUuid
Description copied from interface:MailSet theUUIDwhich is needed to group the mails sent from the same task- Specified by:
setTaskUuidin interfaceMail- Parameters:
taskUuid- a random uuid given from the task which sends the mail
-
getBody
- Specified by:
getBodyin interfaceMail- Throws:
MailException
-
getMimeMessageHeaders
public Map<String,Iterable<String>> getMimeMessageHeaders() throws MailException, jakarta.mail.MessagingException- Specified by:
getMimeMessageHeadersin interfaceMail- Throws:
MailExceptionjakarta.mail.MessagingException
-
getMimeMessageFrom
- Specified by:
getMimeMessageFromin interfaceMail- Throws:
jakarta.mail.MessagingExceptionMailException
-
addMailListener
- Specified by:
addMailListenerin interfaceMail
-
removeMailListener
- Specified by:
removeMailListenerin interfaceMail
-