Class AbstractOutgoingMail
java.lang.Object
ch.tocco.nice2.messaging.mail.spi.AbstractBaseMail
ch.tocco.nice2.messaging.mail.spi.AbstractOutgoingMail
-
Nested Class Summary
Nested classes/interfaces inherited from interface Mail
Mail.MailListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected @Nullable Entityprotected final booleanprotected org.joda.time.LocalDateprotected Set<Mail.MailListener> protected final MailArchiveprotected final MailSendThrottleprotected final Supplier<Nice2Template> protected final PersistenceServiceprotected booleanprotected final MessageProcessorprotected Entityprotected Entityprotected Entityprotected booleanprotected Entityprotected UUIDprotected final TemplateEngineprotected @Nullable EntityFields inherited from class AbstractBaseMail
attachments, bcc, cc, from, html, log, replyTo, subject, text, toFields inherited from interface BaseMail
NO_SUBJECT -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOutgoingMail(String subject, MessageProcessor processor, PersistenceService persistenceService, org.slf4j.Logger log, TemplateEngineFactory templateEngineFactory, MailArchive mailArchive, MailSendThrottle mailSendThrottle, Boolean encodeFileNames) -
Method Summary
Modifier and TypeMethodDescriptionAdd the address from a User entity to "bcc".addBcc(EntityList userEntityList) Add addresses from User entities to "bcc".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>"Add the address from a User entity to "cc".addCc(EntityList userEntityList) Add addresses from User entities to "cc".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>"voidaddMailListener(Mail.MailListener listener) addSourceEntity(Entity sourceEntity) Set Email_archive relation to all entities in this listaddTo(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 userEntityList) Add addresses from User entities to "to".protected voidclone()protected abstract MailArchive.MailArchiveEntrydoSend()@Nullable Entityorg.joda.time.LocalDategetTemplateAttribute(String name) Get the value of a template attribute.Get an unmodifiable map of all template attributes.@Nullable EntitybooleanbooleanpreventFromArchive(boolean preventFromArchive) protected StringprocessTemplate(String input) protected StringprocessTemplate(String input, boolean htmlEscape) protected StringvoidremoveMailListener(Mail.MailListener listener) voidsend()Send the message.voidsetCharset(String charset) setContactCategory(@Nullable Entity contactCategory) setExpiryDate(org.joda.time.LocalDate expiryDate) setRecipientEntity(Entity recipientEntity) setRelatedEntity(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(Entity sourceEntity) 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 attributeMethods inherited from class AbstractBaseMail
addAttachment, addBcc, addBcc, addCc, addCc, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, clearAttachments, clearBcc, clearCc, clearReplyTo, clearTo, containsAttachment, createAttachment, createAttachment, createAttachment, getAttachments, getBcc, getCc, getFrom, getHtml, getReplyTo, getSubject, getText, getTo, isBodyEmpty, mergeWithExistingHtml, removeAttachment, setBcc, setCc, setFrom, setHtml, setReplyTo, setSubject, setText, setTo, toStringMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BaseMail
addAttachment, addBcc, addBcc, addCc, addCc, addReplyTo, addReplyTo, addReplyTo, addTo, addTo, addTo, clearAttachments, clearBcc, clearCc, clearReplyTo, clearTo, createAttachment, createAttachment, createAttachment, getAttachments, getBcc, getCc, getFrom, getHtml, getReplyTo, getSubject, getText, getTo, isBodyEmpty, setFrom, setHtml, setSubject, setTextMethods inherited from interface Mail
containsAttachment, getBody, getMimeMessageFrom, getMimeMessageHeaders, removeAttachment
-
Field Details
-
sourceEntity
-
sourceEntities
-
recipientEntity
-
expiryDate
protected org.joda.time.LocalDate expiryDate -
sender
-
templateEntity
-
contactCategory
-
preventFromArchive
protected boolean preventFromArchive -
taskUuid
-
encodeFileNames
protected final boolean encodeFileNames -
charset
-
attributes
-
processor
-
persistenceService
-
mailArchive
-
templateEngine
-
nice2Template
-
singleCopyMail
protected boolean singleCopyMail -
templateAttributes
-
mailSendThrottle
-
listeners
-
-
Constructor Details
-
AbstractOutgoingMail
public AbstractOutgoingMail(String subject, MessageProcessor processor, PersistenceService persistenceService, org.slf4j.Logger log, TemplateEngineFactory templateEngineFactory, MailArchive mailArchive, MailSendThrottle mailSendThrottle, Boolean encodeFileNames)
-
-
Method Details
-
processTemplate
- Throws:
MailException
-
processTemplateWithHtmlEscape
- Throws:
MailException
-
processTemplate
- Throws:
MailException
-
getSourceEntity
- Specified by:
getSourceEntityin interfaceMail
-
setSourceEntity
- Specified by:
setSourceEntityin interfaceMail
-
addSourceEntity
Set Email_archive relation to all entities in this list- 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
-
addTo
Description copied from interface:MailAdd addresses from User entities to "to". -
addCc
-
addCc
Description copied from interface:MailAdd addresses from User entities to "cc". -
addBcc
-
addBcc
Description copied from interface:MailAdd addresses from User entities to "bcc". -
hasNoRecipients
public boolean hasNoRecipients()- Specified by:
hasNoRecipientsin interfaceBaseMail- Overrides:
hasNoRecipientsin classAbstractBaseMail
-
getContactCategory
- Specified by:
getContactCategoryin interfaceMail
-
setContactCategory
- Specified by:
setContactCategoryin interfaceMail
-
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
-
getTemplateEntity
- Specified by:
getTemplateEntityin interfaceMail
-
setTemplateEntity
- Specified by:
setTemplateEntityin 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
-
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
-
preventFromArchive
- Specified by:
preventFromArchivein interfaceMail
-
getCharset
-
setCharset
-
getAttributes
- Specified by:
getAttributesin interfaceMail
-
getExpiryDate
public org.joda.time.LocalDate getExpiryDate()- Specified by:
getExpiryDatein interfaceMail
-
setExpiryDate
- Specified by:
setExpiryDatein interfaceMail
-
getTaskUuid
- Specified by:
getTaskUuidin interfaceMail
-
setTaskUuid
-
checkRecipientAndContent
- Throws:
MailExceptionjakarta.mail.MessagingException
-
send
Description copied from interface:MailSend the message.- Specified by:
sendin interfaceMail- Throws:
MailException
-
doSend
- Throws:
MailException
-
clone
- Specified by:
clonein interfaceMail- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
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>"- Specified by:
addCcin interfaceBaseMail- Overrides:
addCcin classAbstractBaseMail- Parameters:
addresses- String separated with "," or "\n"
-
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>"- Specified by:
addBccin interfaceBaseMail- Overrides:
addBccin classAbstractBaseMail- Parameters:
addresses- String separated with "," or "\n"
-
addMailListener
- Specified by:
addMailListenerin interfaceMail
-
removeMailListener
- Specified by:
removeMailListenerin interfaceMail
-