public abstract class SMTPAppenderBase<E> extends AppenderBase<E>
| Modifier and Type | Field and Description |
|---|---|
protected CyclicBufferTracker |
cbTracker
|
protected Discriminator |
discriminator
|
protected EventEvaluator |
eventEvaluator
|
protected Layout |
layout
|
protected Session |
session
|
protected Layout |
subjectLayout
|
name, startedcontext| Constructor and Description |
|---|
SMTPAppenderBase()
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTo(String
|
protected void |
append(E eventObject)
Perform SMTPAppender specific appending actions, delegating some of them to a subclass and checking if the event triggers an e-mail to be sent.
|
boolean |
checkEntryConditions()
This method determines if there is a sense in attempting to append.
|
protected abstract boolean |
eventMarksEndOfLife(E eventObject)
|
protected abstract void |
fillBuffer(CyclicBuffer
|
String |
getCharsetEncoding()
|
CyclicBufferTracker |
getCyclicBufferTracker()
|
Discriminator |
getDiscriminator()
|
String |
getFrom()
Returns value of the
From option.
|
String |
getJndiLocation()
|
Layout |
getLayout()
|
String |
getLocalhost()
|
String |
getPassword()
|
String |
getSmtpHost()
Returns value of the
SMTPHost option.
|
String |
getSMTPHost()
Alias for getSmtpHost().
|
int |
getSmtpPort()
See
setSmtpPort(int)
|
int |
getSMTPPort()
Alias for
getSmtpPort()
|
String |
getSubject()
Returns value of the
Subject option.
|
List |
getToAsListOfString()
|
List |
getToList()
Returns value of the
toList option.
|
String |
getUsername()
|
boolean |
isAsynchronousSending()
|
boolean |
isSessionViaJNDI()
|
boolean |
isSSL()
|
boolean |
isSTARTTLS()
|
protected abstract PatternLayoutBase |
makeNewToPatternLayout(String
|
protected abstract Layout |
makeSubjectLayout(String
return a layout for the subject string as appropriate for the module.
|
protected void |
sendBuffer(CyclicBuffer
Send the contents of the cyclic buffer as an e-mail message.
|
void |
setAsynchronousSending(boolean asynchronousSending)
By default, SMTAppender transmits emails asynchronously.
|
void |
setCharsetEncoding(String
Set the character set encoding of the outgoing email messages.
|
void |
setCyclicBufferTracker(CyclicBufferTracker
|
void |
setDiscriminator(Discriminator
|
void |
setEvaluator(EventEvaluator
The
EventEvaluator option takes a string value representing the name of the class implementing the
EventEvaluator interface.
|
void |
setFrom(String
The
From option takes a string value which should be a e-mail address of the sender.
|
void |
setJndiLocation(String
Set the location where a
javax.mail.Session resource is located in JNDI.
|
void |
setLayout(Layout
|
void |
setLocalhost(String
Set the "mail.smtp.localhost" property to the value passed as parameter to this method.
|
void |
setPassword(String
|
void |
setSessionViaJNDI(boolean sessionViaJNDI)
If set to true, a
javax.mail.Session resource will be retrieved from JNDI.
|
void |
setSmtpHost(String
The
smtpHost option takes a string value which should be a the host name of the SMTP server that will send the e-mail message.
|
void |
setSMTPHost(String
Alias for smtpHost
|
void |
setSmtpPort(int port)
The port where the SMTP server is running.
|
void |
setSMTPPort(int port)
Alias for
setSmtpPort(int).
|
void |
setSSL(boolean ssl)
|
void |
setSTARTTLS(boolean startTLS)
|
void |
setSubject(String
The
Subject option takes a string value which should be a the subject of the e-mail message.
|
void |
setUsername(String
|
void |
start()
Start the appender
|
void |
stop()
|
protected abstract void |
subAppend(CyclicBuffer
|
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextprotected Session session
protected EventEvaluator<E> eventEvaluator
protected Discriminator<E> discriminator
protected CyclicBufferTracker<E> cbTracker
protected abstract Layout<E> makeSubjectLayout(String subjectStr)
subjectStr -
public void start()
protected void append(E eventObject)
protected abstract boolean eventMarksEndOfLife(E eventObject)
protected abstract void subAppend(CyclicBuffer<E> cb, E eventObject)
public boolean checkEntryConditions()
false is returned.
public void stop()
public List<PatternLayoutBase <E>> getToList()
protected void sendBuffer(CyclicBuffer<E> cb, E lastEventObject)
protected abstract void fillBuffer(CyclicBuffer<E> cb, StringBuffer sbuf)
public StringgetFrom()
public StringgetSubject()
public void setFrom(Stringfrom)
public void setSubject(Stringsubject)
public void setSMTPHost(StringsmtpHost)
smtpHost -
public void setSmtpHost(StringsmtpHost)
public StringgetSMTPHost()
public StringgetSmtpHost()
public void setSMTPPort(int port)
setSmtpPort(int).
port -
public void setSmtpPort(int port)
port -
public int getSMTPPort()
getSmtpPort()
public int getSmtpPort()
setSmtpPort(int)
public StringgetLocalhost()
public void setLocalhost(Stringlocalhost)
Useful in case the hostname for the client host is not fully qualified and as a consequence the SMTP server rejects the clients HELO/EHLO command.
localhost -
public CyclicBufferTracker<E> getCyclicBufferTracker()
public void setCyclicBufferTracker(CyclicBufferTracker<E> cbTracker)
public Discriminator<E> getDiscriminator()
public void setDiscriminator(Discriminator<E> discriminator)
public boolean isAsynchronousSending()
public void setAsynchronousSending(boolean asynchronousSending)
asynchronousSending - determines whether sending is done asynchronously or not
public void addTo(Stringto)
protected abstract PatternLayoutBase<E> makeNewToPatternLayout(String toPattern)
public boolean isSTARTTLS()
public void setSTARTTLS(boolean startTLS)
public boolean isSSL()
public void setSSL(boolean ssl)
public void setEvaluator(EventEvaluator<E> eventEvaluator)
EventEvaluator interface. A corresponding object will be instantiated and assigned as the event evaluator for the SMTPAppender.
public StringgetUsername()
public void setUsername(Stringusername)
public StringgetPassword()
public void setPassword(Stringpassword)
public StringgetCharsetEncoding()
setCharsetEncoding(String)
public StringgetJndiLocation()
public void setJndiLocation(StringjndiLocation)
javax.mail.Session resource is located in JNDI. Default value is "java:comp/env/mail/Session".
jndiLocation -
public boolean isSessionViaJNDI()
public void setSessionViaJNDI(boolean sessionViaJNDI)
javax.mail.Session resource will be retrieved from JNDI. Default is false.
sessionViaJNDI - whether to obtain a javax.mail.Session by JNDI
public void setCharsetEncoding(StringcharsetEncoding)
charsetEncoding -