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 ch.tocco.nice2.messaging.mail.api.Mail
Mail.MailListener
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected @Nullable Entity
protected final boolean
protected org.joda.time.LocalDate
protected Set
<Mail.MailListener> protected final MailArchive
protected final MailSendThrottle
protected final Supplier
<Nice2Template> protected final PersistenceService
protected boolean
protected final MessageProcessor
protected Entity
protected Entity
protected Entity
protected boolean
protected Entity
protected UUID
protected final TemplateEngine
protected @Nullable Entity
Fields inherited from class ch.tocco.nice2.messaging.mail.spi.AbstractBaseMail
attachments, bcc, cc, from, html, log, replyTo, subject, text, to
Fields inherited from interface ch.tocco.nice2.messaging.mail.api.BaseMail
NO_SUBJECT
-
Constructor Summary
ConstructorDescriptionAbstractOutgoingMail
(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".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>"Add the address from a User entity to "cc".addCc
(EntityList userEntityList) Add addresses from User entities to "cc".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
addMailListener
(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 void
clone()
protected abstract MailArchive.MailArchiveEntry
doSend()
@Nullable Entity
org.joda.time.LocalDate
getTemplateAttribute
(String name) Get the value of a template attribute.Get an unmodifiable map of all template attributes.@Nullable Entity
boolean
preventFromArchive
(boolean preventFromArchive) protected String
processTemplate
(String input) protected String
processTemplate
(String input, boolean htmlEscape) protected String
void
removeMailListener
(Mail.MailListener listener) void
send()
Send the message.void
setCharset
(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 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 attributeMethods inherited from class ch.tocco.nice2.messaging.mail.spi.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, mergeWithExistingHtml, removeAttachment, setBcc, setCc, setFrom, setHtml, setReplyTo, setSubject, setText, setTo, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.messaging.mail.api.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, setFrom, setHtml, setSubject, setText
Methods inherited from interface ch.tocco.nice2.messaging.mail.api.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:
getSourceEntity
in interfaceMail
-
setSourceEntity
- Specified by:
setSourceEntity
in interfaceMail
-
addSourceEntity
Set Email_archive relation to all entities in this list- 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
-
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
-
getTemplateEntity
- Specified by:
getTemplateEntity
in interfaceMail
-
setTemplateEntity
- Specified by:
setTemplateEntity
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.
-
preventFromArchive
- Specified by:
preventFromArchive
in interfaceMail
-
getCharset
-
setCharset
-
getAttributes
- Specified by:
getAttributes
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
-
checkRecipientAndContent
- Throws:
MailException
jakarta.mail.MessagingException
-
send
Description copied from interface:Mail
Send the message.- Specified by:
send
in interfaceMail
- Throws:
MailException
-
doSend
- Throws:
MailException
-
clone
- Specified by:
clone
in interfaceMail
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
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>"- Specified by:
addCc
in interfaceBaseMail
- Overrides:
addCc
in classAbstractBaseMail
- Parameters:
addresses
- String separated with "," or "\n"
-
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>"- Specified by:
addBcc
in interfaceBaseMail
- Overrides:
addBcc
in classAbstractBaseMail
- Parameters:
addresses
- String separated with "," or "\n"
-
addMailListener
- Specified by:
addMailListener
in interfaceMail
-
removeMailListener
- Specified by:
removeMailListener
in interfaceMail
-