public interface MessageTemplate
Admin
-interface to get a template
instance from the database or create a new one. Set the message properties like subject, body, recipients using the setter methods. The message is sent with the send method.
Modifier and Type | Method and Description |
---|---|
MessageTemplate |
addAttachment(BodyPart mbp)
Add an attachment to the message
|
MessageTemplate |
addHeader(String key,
String value)
Add a header field to the message.
|
MessageTemplate |
addInlineBodyPart(BodyPart mbp)
Add an inline attachment to the mail (optionally).
|
MessageTemplate |
addRecipient(Recipient rec)
Add one recipients.
|
MessageTemplate |
addRecipient(String email)
Add an email address as recipient.
|
MessageTemplate |
addRecipient(User user)
Add a user as recipient.
|
MessageTemplate |
addRecipients(List<Recipient> recs)
Add a list of recipients.
|
MessageTemplate |
clearRecipients(Message.RecipientType type)
Remove all recipients of the given type from the message.
|
Message |
createMessage()
Creates a new
Message object with the data of this MessageTemplate. |
String |
getBody()
Get the message body.
|
String |
getDescription()
Get the description of the template.
|
String |
getId()
Get the id of the template.
|
MailQueueItem |
getMailQueueItem()
Returns a
MailQueueItem which could be set after sending mail |
MailSender |
getMailSender()
get the mail sender
|
Message |
getMessage()
Get the
Message object of MessageTemplate instance which has been created
by the send() method implicitly or by the createMessage() method explicitly. |
String |
getMessageCharset()
Get the character set of the message
|
String |
getMimeType()
Get the mime type
|
String |
getName()
Get the name of the template.
|
List<Recipient> |
getRecipients()
Return the list of recipients.
|
String |
getReplyTo()
Get the optional Reply-to header
|
String |
getReplyToMsgId()
Get the optional In-Reply-To header (the message-id of the replying mail)
|
String |
getSenderAddress()
Get the sender mail address.
|
String |
getSubject()
Get the message subject.
|
boolean |
isActive()
Is the template active
|
boolean |
isAddedToProcess()
Returns true if the mail message is added to the process
|
boolean |
isLogged()
Returns true if the message is logged in the mail journal
|
void |
makeReplacements()
Make the replacements in subject and body.
|
boolean |
send()
Send the message.
|
MessageTemplate |
setActive(boolean active)
Set the message template to active.
|
MessageTemplate |
setActivityInstance(ActivityInstance ai)
Set the message context (used for template replacements) to the given activity instance.
|
MessageTemplate |
setAddToProcess(boolean add)
Add the message to the process.
|
MessageTemplate |
setBody(String body)
Set the message body.
|
MessageTemplate |
setBodyUrl(String url)
Set the message body.
|
MessageTemplate |
setDocument(DMSObject doc)
Set the message context (used for template replacements) to the given document.
|
MessageTemplate |
setLocale(Locale l)
Set the locale that is used for internationalization of the message.
|
MessageTemplate |
setLogged(boolean l)
Log the message into the mail journal.
|
MessageTemplate |
setMailSender(MailSender ms)
Set the mail sender for using specific properties for sender and communication settings.
|
MessageTemplate |
setMessageCharset(String charset)
Set the character set for the message (optionally).
|
MessageTemplate |
setMimeType(String mimetype)
Set the mime-type.
|
MessageTemplate |
setProcessInstance(ProcessInstance pi)
Set the message context (used for template replacements) to the given process instance.
|
MessageTemplate |
setQueueAction(MailSender.MailAction ma)
Set the queue behavior.
|
MessageTemplate |
setReplace(boolean b)
Call with true, if you want that replacements are done in subject and body.
|
MessageTemplate |
setReplyTo(String replyto)
Set the Reply-to header
|
MessageTemplate |
setReplyToMsgId(String replyto_msgid)
Set the In-Reply-To header (the message-id of the replying mail)
|
MessageTemplate |
setSubject(String subject)
Set the message subject.
|
MessageTemplate |
setVariableValue(String key,
Object value)
Define a variable for template substitution.
|
MessageTemplate setActive(boolean active)
MessageTemplate setMimeType(String mimetype)
mimetype
- text/plain or text/html, the latter is the default.MessageTemplate setSubject(String subject)
MessageTemplate setBody(String body)
MessageTemplate setBodyUrl(String url)
url
- the url points to a resource in the classpathMessageTemplate addRecipients(List<Recipient> recs)
MessageTemplate addRecipient(Recipient rec)
MessageTemplate addRecipient(User user)
MessageTemplate addRecipient(String email)
MessageTemplate clearRecipients(Message.RecipientType type)
String getReplyTo()
MessageTemplate setReplyTo(String replyto)
String getReplyToMsgId()
String getSenderAddress()
MessageTemplate addHeader(String key, String value)
MessageTemplate setReplyToMsgId(String replyto_msgid)
String getMessageCharset()
MessageTemplate setMessageCharset(String charset)
MessageTemplate setLogged(boolean l)
MessageTemplate setAddToProcess(boolean add)
MessageTemplate setProcessInstance(ProcessInstance pi)
MessageTemplate setActivityInstance(ActivityInstance ai)
MessageTemplate setDocument(DMSObject doc)
MessageTemplate setVariableValue(String key, Object value)
key
- a key for referencing the objectvalue
- the value, can be a string, number, date, persistent, etc.MessageTemplate setLocale(Locale l)
MessageTemplate addAttachment(BodyPart mbp)
MessageTemplate addInlineBodyPart(BodyPart mbp)
MessageTemplate setQueueAction(MailSender.MailAction ma)
ma
- one of the mail action values: QUEUE, DEFFERRED, NO_QUEUEMessageTemplate setMailSender(MailSender ms)
MailSender getMailSender()
MailQueueItem getMailQueueItem()
MailQueueItem
which could be set after sending mailMailQueueItem
, otherwise null
Message createMessage()
Message
object with the data of this MessageTemplate.Message getMessage()
Message
object of MessageTemplate instance which has been created
by the send()
method implicitly or by the createMessage()
method explicitly.MessageTemplate setReplace(boolean b)
b
- void makeReplacements() throws Exception
Exception
boolean send()
Message
is generated, if not already done e.g. by method createMessage()
or by a previous call of
the send()
method.
Depending on the kind of sending, the message is sent immediately or put into the message queue.true
, if mail could be sent or false
, if mail could not be sent or
if mail has been inserted into mail queue. In all other cases an Exception is thrown.String getId()
String getName()
String getDescription()
String getSubject()
String getBody()
String getMimeType()
boolean isActive()
boolean isLogged()
boolean isAddedToProcess()
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.