Package org.frankframework.senders
Class AbstractMailSender
java.lang.Object
org.frankframework.senders.AbstractSender
org.frankframework.senders.AbstractSenderWithParameters
org.frankframework.senders.AbstractMailSender
- All Implemented Interfaces:
- FrankElement,- HasApplicationContext,- HasName,- IConfigurable,- IScopeProvider,- ISender,- ISenderWithParameters,- IWithParameters,- NameAware,- org.springframework.beans.factory.Aware,- org.springframework.context.ApplicationContextAware,- org.springframework.context.Lifecycle
- Direct Known Subclasses:
- MailSender,- SendGridSender
@DestinationType(MAIL)
public abstract class AbstractMailSender
extends AbstractSenderWithParameters
- 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/plainandtext/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><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 SummaryNested ClassesModifier and TypeClassDescriptionstatic classGeneric mail classprotected static classGeneric mail attachment classstatic classclassGeneric email class
- 
Field SummaryFields inherited from class org.frankframework.senders.AbstractSenderWithParametersparameterNamesMustBeUnique, paramListFields inherited from class org.frankframework.senders.AbstractSenderlog
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidConfigure this component.protected abstract AbstractMailSender.MailSessionBaseextract(Message input, PipeLineSession session) Reads fields from either paramList or Xml filebooleanWhentrue, the result of sendMessage is the reply of the request.protected abstract voidsendEmail(AbstractMailSender.MailSessionBase mailSession) sendMessage(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).voidsetAuthAlias(String authAlias) authAlias used to obtain credentials for authenticationvoidsetBounceAddress(String string) NDR return address when mail cannot be delivered.voidsetDefaultAttachmentName(String defaultAttachmentName) When this name is used, it will be followed by a number which is equal to the node's positionvoidsetDefaultFrom(String defaultFrom) Set the default from: header, if not specified in message itselfvoidsetDefaultMessageBase64(boolean defaultMessageBase64) When messageBase64 is not specified defaultMessageBase64 will be usedvoidsetDefaultMessageType(String defaultMessageType) When messageType is not specified defaultMessageType will be usedvoidsetDefaultSubject(String defaultSubject) Set the default value of the subject: header, if not specified in message itselfvoidsetDomainWhitelist(String domainWhitelist) Comma separated list of domains to which mails can be send, domains not on the list are filtered out.voidsetPassword(String password) password of useridvoidsetTimeout(int timeout) Timeout in milliseconds for socket connection timeout and socket i/o timeoutsvoiduserId on the smtphostMethods inherited from class org.frankframework.senders.AbstractSenderWithParametersaddParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueListMethods inherited from class org.frankframework.senders.AbstractSendercreateBean, getLogPrefix, getName, isRunning, setApplicationContext, setName, start, stopMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAwaresetApplicationContextMethods inherited from interface org.frankframework.core.FrankElementaddConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContextgetApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.ISendersendMessageOrThrow, start, stop
- 
Constructor Details- 
AbstractMailSenderpublic AbstractMailSender()
 
- 
- 
Method Details- 
sendEmailprotected abstract void sendEmail(AbstractMailSender.MailSessionBase mailSession) throws SenderException - Throws:
- SenderException
 
- 
configureDescription copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply. - Specified by:
- configurein interface- IConfigurable
- Overrides:
- configurein class- AbstractSenderWithParameters
- Throws:
- ConfigurationException- in case it was not able to configure the component.
 
- 
sendMessage@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException Description copied from interface:ISenderSend 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()returnstruefalsereturn 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
 
- 
extractpublic AbstractMailSender.MailSessionBase extract(Message input, PipeLineSession session) throws SenderException, DomBuilderException Reads fields from either paramList or Xml file- Throws:
- SenderException
- DomBuilderException
 
- 
createMailSession- Throws:
- SenderException
 
- 
isSynchronouspublic boolean isSynchronous()Description copied from interface:ISenderWhentrue, the result of sendMessage is the reply of the request.
- 
setAuthAliasauthAlias used to obtain credentials for authentication
- 
setUserIduserId on the smtphost
- 
setPasswordpassword of userid
- 
setDefaultSubjectSet the default value of the subject: header, if not specified in message itself
- 
setDefaultFromSet the default from: header, if not specified in message itself
- 
setTimeoutpublic void setTimeout(int timeout) Timeout in milliseconds for socket connection timeout and socket i/o timeouts- Default value
- 20000
 
- 
setDefaultAttachmentNameWhen this name is used, it will be followed by a number which is equal to the node's position- Default value
- attachment
 
- 
setDefaultMessageTypeWhen messageType is not specified defaultMessageType will be used- Default value
- text/plain
 
- 
setDefaultMessageBase64public void setDefaultMessageBase64(boolean defaultMessageBase64) When messageBase64 is not specified defaultMessageBase64 will be used- Default value
- false
 
- 
setBounceAddressNDR return address when mail cannot be delivered. This adds a Return-Path header- Default value
- MAIL FROM attribute
 
- 
setDomainWhitelistComma separated list of domains to which mails can be send, domains not on the list are filtered out. Empty allows all domains
 
-