Package org.frankframework.senders
Class AbstractMailSender
java.lang.Object
org.frankframework.senders.AbstractSender
org.frankframework.senders.AbstractSenderWithParameters
org.frankframework.senders.AbstractMailSender
- All Implemented Interfaces:
IConfigurable
,IConfigurationAware
,INamedObject
,IScopeProvider
,ISender
,ISenderWithParameters
,IWithParameters
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
MailSender
,SendGridSender
- Specific parameters
- from email address of the sender, subject subject field of the message, threadTopic (optional) conversation field of the message, used to correlate mails in mail viewer (header field "Thread-Topic"). Note: subject must end with value of threadTopic, but cann't be exactly the same, message message itself. If absent, the complete input message is assumed to be the message, messageType message MIME type (at this moment only available are
text/plain
andtext/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:
, attachments (xml) attachments to the message. Must result in a structure like:<recipient type="to">***@hotmail.com</recipient> <recipient type="cc">***@gmail.com</recipient>
<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"/>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Generic mail classprotected static class
Generic mail attachment classstatic class
class
Generic email class -
Field Summary
Fields inherited from class org.frankframework.senders.AbstractSenderWithParameters
parameterNamesMustBeUnique, paramList
Fields inherited from class org.frankframework.senders.AbstractSender
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure()
is called once at startup of the framework in the configure method of the owner of this sender.protected abstract AbstractMailSender.MailSessionBase
extract
(Message input, PipeLineSession session) Reads fields from either paramList or Xml fileint
boolean
boolean
Whentrue
, the result of sendMessage is the reply of the request.protected abstract void
sendEmail
(AbstractMailSender.MailSessionBase mailSession) 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 authenticationvoid
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 positionvoid
setDefaultFrom
(String defaultFrom) Set the default from: header, if not specified in message itselfvoid
setDefaultMessageBase64
(boolean defaultMessageBase64) when messageBase64 is not specified defaultMessageBase64 will be usedvoid
setDefaultMessageType
(String defaultMessageType) when messageType is not specified defaultMessageType will be usedvoid
setDefaultSubject
(String defaultSubject) Set the default value of the subject: header, if not specified in message itselfvoid
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 useridvoid
setTimeout
(int timeout) Timeout in milliseconds for socket connection timeout and socket i/o timeoutsvoid
userId on the smtphostMethods inherited from class org.frankframework.senders.AbstractSenderWithParameters
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueList
Methods inherited from class org.frankframework.senders.AbstractSender
createBean, getApplicationContext, getConfigurationClassLoader, getLogPrefix, getName, setApplicationContext, setName, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.IConfigurationAware
getApplicationContext, getName
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
Methods inherited from interface org.frankframework.core.ISender
sendMessageOrThrow, start, stop
-
Constructor Details
-
AbstractMailSender
public AbstractMailSender()
-
-
Method Details
-
sendEmail
protected abstract void sendEmail(AbstractMailSender.MailSessionBase mailSession) throws SenderException - Throws:
SenderException
-
configure
Description copied from interface: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 theconfigure()
oropen()
method, to improve performance.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceISender
- Overrides:
configure
in classAbstractSenderWithParameters
- Throws:
ConfigurationException
-
sendMessage
@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException Description copied from interface:ISender
Send a message to some destination (as configured in the Sender object). This method may only be called after theconfigure()
method is called.The following table shows the difference between synchronous and a-synchronous senders:
synchronous a-synchronous ISender.isSynchronous()
returnstrue
false
return value of sendMessage()
isthe 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
.- Throws:
SenderException
TimeoutException
-
extract
public AbstractMailSender.MailSessionBase extract(Message input, PipeLineSession session) throws SenderException, DomBuilderException Reads fields from either paramList or Xml file- Throws:
SenderException
DomBuilderException
-
createMailSession
- Throws:
SenderException
-
isSynchronous
public boolean isSynchronous()Description copied from interface:ISender
Whentrue
, the result of sendMessage is the reply of the request. -
setAuthAlias
authAlias used to obtain credentials for authentication -
setUserId
userId on the smtphost -
setPassword
password of userid -
setDefaultSubject
Set the default value of the subject: header, if not specified in message itself -
setDefaultFrom
Set the default from: header, if not specified in message itself -
setTimeout
public void setTimeout(int timeout) Timeout in milliseconds for socket connection timeout and socket i/o timeouts- Default value
- 20000
-
setDefaultAttachmentName
When this name is used, it will be followed by a number which is equal to the node's position- Default value
- attachment
-
setDefaultMessageType
when messageType is not specified defaultMessageType will be used- Default value
- text/plain
-
setDefaultMessageBase64
public void setDefaultMessageBase64(boolean defaultMessageBase64) when messageBase64 is not specified defaultMessageBase64 will be used- Default value
- false
-
setBounceAddress
NDR return address when mail cannot be delivered. This adds a Return-Path header- Default value
- MAIL FROM attribute
-
setDomainWhitelist
Comma separated list of domains to which mails can be send, domains not on the list are filtered out. Empty allows all domains -
getAuthAlias
-
getUserId
-
getPassword
-
getCredentialFactory
-
getDefaultAttachmentName
-
getDefaultMessageType
-
isDefaultMessageBase64
public boolean isDefaultMessageBase64() -
getDefaultSubject
-
getDefaultFrom
-
getTimeout
public int getTimeout() -
getBounceAddress
-
getDomainWhitelist
-