public abstract class MailSenderBase extends SenderWithParametersBase
text/plain
and text/html
- default: text/plain
), messageBase64 (boolean) indicates whether the message content is base64 encoded (default: false
), charSet the character encoding (e.g. ISO-8859-1 or UTF-8) used to send the email (default: UTF-8), recipients (xml) recipients of the message. Must result in a structure like:
<recipient type="to">***@hotmail.com</recipient>
<recipient type="cc">***@gmail.com</recipient>
, attachments (xml) attachments to the message. Must result in a structure like:
<attachment name="filename1.txt">This is the first attachment</attachment>
<attachment name="filename2.pdf" base64="true">JVBERi0xLjQKCjIgMCBvYmoKPDwvVHlwZS9YT2JqZWN0L1N1YnR5cGUvSW1...vSW5mbyA5IDAgUgo+PgpzdGFydHhyZWYKMzQxNDY2CiUlRU9GCg==</attachment>
<attachment name="filename3.pdf" url="file:/c:/filename3.pdf"/>
<attachment name="filename4.pdf" sessionKey="fileContent"/>
Modifier and Type | Class and Description |
---|---|
class |
MailSenderBase.EMail
Generic mail class
|
protected class |
MailSenderBase.MailAttachmentBase<T>
Generic mail attachment class
|
protected class |
MailSenderBase.MailAttachmentStream |
class |
MailSenderBase.MailSessionBase
Generic email class
|
parameterNamesMustBeUnique, paramList
log
Constructor and Description |
---|
MailSenderBase() |
Modifier and Type | Method and Description |
---|---|
void |
configure()
configure() is called once at startup of the framework in the configure method of the owner of this sender. |
protected abstract MailSenderBase.MailSessionBase |
createMailSession() |
MailSenderBase.MailSessionBase |
extract(Message input,
PipeLineSession session)
Reads fields from either paramList or Xml file
|
boolean |
isSynchronous()
When
true , the result of sendMessage is the reply of the request. |
protected abstract String |
sendEmail(MailSenderBase.MailSessionBase mailSession) |
SenderResult |
sendMessage(Message message,
PipeLineSession session)
Send a message to some destination (as configured in the Sender object).
|
void |
setAuthAlias(String authAlias)
authAlias used to obtain credentials for authentication
|
void |
setBounceAddress(String string)
NDR return address when mail cannot be delivered.
|
void |
setDefaultAttachmentName(String defaultAttachmentName)
When this name is used, it will be followed by a number which is equal to the node's position
|
void |
setDefaultFrom(String defaultFrom)
value of the from: header if not specified in message itself
|
void |
setDefaultMessageBase64(boolean defaultMessageBase64)
when messageBase64 is not specified defaultMessageBase64 will be used
|
void |
setDefaultMessageType(String defaultMessageType)
when messageType is not specified defaultMessageType will be used
|
void |
setDefaultSubject(String defaultSubject)
value of the subject: header if not specified in message itself
|
void |
setDomainWhitelist(String domainWhitelist)
Comma separated list of domains to which mails can be send, domains not on the list are filtered out.
|
void |
setPassword(String password)
password of userid
|
void |
setSmtpAuthAlias(String smtpAuthAlias)
Deprecated.
|
void |
setSmtpPassword(String smtpPassword)
Deprecated.
|
void |
setSmtpUserid(String smtpUserId)
Deprecated.
|
void |
setTimeout(int timeout)
Timeout in milliseconds for socket connection timeout and socket i/o timeouts
|
void |
setUserId(String userId)
userId on the smtphost
|
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueList
close, createBean, getLogPrefix, getName, open, setApplicationContext, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, open, sendMessageOrThrow
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
protected abstract String sendEmail(MailSenderBase.MailSessionBase mailSession) throws SenderException
SenderException
public void configure() throws ConfigurationException
ISender
configure()
is called once at startup of the framework in the configure method of the owner of this sender.
Purpose of this method is to check whether the static configuration of the sender is correct.
As much as possible class-instantiating should take place in the configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface ISender
configure
in class SenderWithParametersBase
ConfigurationException
public SenderResult sendMessage(Message message, PipeLineSession session) throws SenderException, TimeoutException
ISender
configure()
method is called.
The following table shows the difference between synchronous and a-synchronous senders:
synchronous | a-synchronous | |
---|---|---|
ISender.isSynchronous() returns | true | false |
return value of sendMessage() is | the reply-message | the messageId of the message sent |
the correlationID specified with sendMessage() | may be ignored | is sent with the message |
a {link TimeOutException} | may be thrown if a timeout occurs waiting for a reply | should not be expected |
Multiple objects may try to call this method at the same time, from different threads.
Implementations of this method should therefore be thread-safe, or synchronized
.
SenderException
TimeoutException
public MailSenderBase.MailSessionBase extract(Message input, PipeLineSession session) throws SenderException, DomBuilderException
SenderException
DomBuilderException
protected abstract MailSenderBase.MailSessionBase createMailSession() throws SenderException
SenderException
public boolean isSynchronous()
ISender
true
, the result of sendMessage is the reply of the request.public void setAuthAlias(String authAlias)
public void setUserId(String userId)
public void setPassword(String password)
@Deprecated public void setSmtpAuthAlias(String smtpAuthAlias)
@Deprecated public void setSmtpUserid(String smtpUserId)
@Deprecated public void setSmtpPassword(String smtpPassword)
public void setDefaultSubject(String defaultSubject)
public void setDefaultFrom(String defaultFrom)
public void setTimeout(int timeout)
public void setDefaultAttachmentName(String defaultAttachmentName)
public void setDefaultMessageType(String defaultMessageType)
public void setDefaultMessageBase64(boolean defaultMessageBase64)
public void setBounceAddress(String string)
public void setDomainWhitelist(String domainWhitelist)
Copyright © 2023 Frank!Framework. All rights reserved.