|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.config.DefaultConfigurable
org.norther.tammi.core.mail.DefaultMailSender
public class DefaultMailSender
A default implementation of MailSender.
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
MODIFIED, SYNCHRONIZED, UNMODIFIED |
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.mail.MailSender |
|---|
MAIL_DEBUG_PROPERTY, MAIL_FROM_PROPERTY, MAIL_HOST_PROPERTY, MAIL_MIME_ADDRESS_STRICT_PROPERTY, MAIL_MIME_CHARSET_PROPERTY, MAIL_PORT_PROPERTY, MAIL_PROPERTY_PREFIX, MAIL_TRANSPORT_PROTOCOL_PROPERTY, MAIL_USER_PROPERTY, MAILSENDER_PASSWORD_PROPERTY, MAILSENDER_PROPERTY_PREFIX, MAILSENDER_X_MAILER_PROPERTY |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultMailSender()
Constructs a new mail sender. |
|
| Method Summary | |
|---|---|
void |
applyServerURL(String server)
Applies the specified URL to the mail server configuration. |
boolean |
getDebug()
Gets debugging flag for JavaMail Session object. |
ObjectName |
getExecutorName()
Gets the the executor of this executable. |
javax.mail.internet.InternetAddress |
getFrom()
Gets the address of the current user. |
String |
getHost()
Gets the host name of the mail server. |
int |
getPort()
Gets the port number of the mail server. |
String |
getProtocol()
Gets the protocol for sending. |
String |
getServerURL()
Gets the mail server to be connected as an URL. |
String |
getUser()
Gets the username for connecting the mail server. |
boolean |
isStarted()
Checks whether the startable has been started. |
void |
run()
Runs in the background message thread that does actual send mail operation using JavaMail. |
void |
sendMail(javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody)
Sends a text-only mail message with minimal addressing information to specified addresses. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] replyToAddress,
javax.mail.internet.InternetAddress senderAddress,
javax.mail.internet.InternetAddress[] toAddress,
javax.mail.internet.InternetAddress[] ccAddress,
javax.mail.internet.InternetAddress[] bccAddress,
String subject,
String messageBody)
Sends a text-only mail message with full addressing information. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] replyToAddress,
javax.mail.internet.InternetAddress senderAddress,
javax.mail.internet.InternetAddress[] toAddress,
javax.mail.internet.InternetAddress[] ccAddress,
javax.mail.internet.InternetAddress[] bccAddress,
String subject,
String messageBody,
String encoding)
Sends an encoded text-only mail message with full addressing information. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody)
Sends a text-only mail message with less addressing information to specified addresses. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody,
String encoding)
Sends an encoded text-only mail message with less addressing information to specified addresses. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody)
Sends a text-only mail message with less addressing information to the specified addresses. |
void |
sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody,
String encoding)
Sends an encoded text-only mail message with less addressing information to the specified address. |
void |
sendMail(javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody)
Sends a text-only mail message with minimal addressing information to the specified address. |
void |
setDebug(boolean debug)
Sets debugging flag for JavaMail Session object. |
void |
setExecutorName(ObjectName executor)
Sets the executor of this executable. |
void |
setFrom(javax.mail.internet.InternetAddress from)
Sets the address of the current user. |
void |
setHost(String host)
Sets the host name of the mail server. |
void |
setHost(String host,
String protocol)
Sets the protocol specific host name of the mail server. |
void |
setPassword(String password)
Sets the password for connecting the mail server. |
void |
setPassword(String password,
String protocol)
Sets the protocol specific password for connecting the mail server. |
void |
setPort(int port)
Sets the port number of the mail server. |
void |
setPort(int port,
String protocol)
Sets the protocol specific port number of the mail server. |
void |
setProtocol(String protocol)
Sets the protocol for sending. |
void |
setUser(String user)
Sets the username for connecting the mail server. |
void |
setUser(String user,
String protocol)
Sets the protocol specific username for connecting the mail server. |
void |
start()
Starts the MBean. |
void |
stop()
Stops the mail queue and discards unsent mail messages. |
| Methods inherited from class org.norther.tammi.core.config.DefaultConfigurable |
|---|
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getConfiguration, getModifiedState, getProperties, getProperty, getPropertyFilePath, indexOfProperty, loadConfiguration, loadConfiguration, loadConfiguration, modified, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setModifiedState, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.norther.tammi.core.config.Configurable |
|---|
addProperty, addProperty, clearProperties, containsProperty, getConfigKey, getProperties, getProperty, getPropertyFilePath, indexOfProperty, propertyMap, propertyMap, removeProperty, removeProperty, setConfigKey, setProperties, setProperty, setPropertyFilePath, setPropertyFilePath, storeProperties |
| Constructor Detail |
|---|
public DefaultMailSender()
| Method Detail |
|---|
public ObjectName getExecutorName()
Executable
getExecutorName in interface Executablepublic void setExecutorName(ObjectName executor)
ExecutableNote that it will be taken into use after next start.
setExecutorName in interface Executableexecutor - the object name of the executor or a query.public boolean isStarted()
Startable
isStarted in interface Startable
public void start()
throws Exception
Startable
start in interface StartableException - if start fails.public void stop()
stop in interface Startablepublic String getServerURL()
MailSender
getServerURL in interface MailSenderpublic void applyServerURL(String server)
MailSenderIf null is given, initializes both the protocol specific and general settings.
applyServerURL in interface MailSenderserver - the URL of the mail server to be connected as a string.public String getProtocol()
MailSender
getProtocol in interface MailSenderpublic void setProtocol(String protocol)
MailSender
setProtocol in interface MailSenderprotocol - the protocol e.g. 'SMTP'.public String getHost()
MailSender
getHost in interface MailSenderpublic void setHost(String host)
MailSender
setHost in interface MailSenderhost - the host name.
public void setHost(String host,
String protocol)
MailSender
setHost in interface MailSenderhost - the host name.protocol - the protocol.public int getPort()
MailSender
getPort in interface MailSenderpublic void setPort(int port)
MailSender
setPort in interface MailSenderport - the port number.
public void setPort(int port,
String protocol)
MailSender
setPort in interface MailSenderport - the port number.protocol - the protocol.public String getUser()
MailSender
getUser in interface MailSenderpublic void setUser(String user)
MailSender
setUser in interface MailSenderuser - the username.
public void setUser(String user,
String protocol)
MailSender
setUser in interface MailSenderuser - the username.protocol - the protocol.public void setPassword(String password)
MailSender
setPassword in interface MailSenderpassword - the password.
public void setPassword(String password,
String protocol)
MailSender
setPassword in interface MailSenderpassword - the password.protocol - the protocol.public javax.mail.internet.InternetAddress getFrom()
MailSenderInternetAddress.getLocalAddress method to specify the
current user's email, default username@host.
getFrom in interface MailSenderpublic void setFrom(javax.mail.internet.InternetAddress from)
MailSenderInternetAddress.getLocalAddress method to specify the
current user's email, default username@host.
setFrom in interface MailSenderfrom - the user mail address.public boolean getDebug()
MailSender
getDebug in interface MailSenderpublic void setDebug(boolean debug)
MailSender
setDebug in interface MailSenderdebug - the debug flag.
public void sendMail(javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody)
throws LogException
MailSender
sendMail in interface MailSendertoAddress - the receiver's mail address.subject - the subject of the mail.messageBody - the mail body as text.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody)
throws LogException
MailSender
sendMail in interface MailSendertoAddress - the receivers' mail addresses.subject - the subject of the mail.messageBody - the mail body as text.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.toAddress - the receiver's mail address.subject - the subject of the mail.messageBody - the mail body as text.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.toAddress - the receivers' mail addresses.subject - the subject of the mail.messageBody - the mail body as text.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress toAddress,
String subject,
String messageBody,
String encoding)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.toAddress - the receiver's mail address.subject - the subject of the mail.messageBody - the mail body as text.encoding - the charset to be applied.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] toAddress,
String subject,
String messageBody,
String encoding)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.toAddress - the receivers' mail addresses.subject - the subject of the mail.messageBody - the mail body as text.encoding - the charset to be applied.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] replyToAddress,
javax.mail.internet.InternetAddress senderAddress,
javax.mail.internet.InternetAddress[] toAddress,
javax.mail.internet.InternetAddress[] ccAddress,
javax.mail.internet.InternetAddress[] bccAddress,
String subject,
String messageBody)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.replyToAddress - reply to addresses (see RFC822 for details).senderAddress - sender addresses (see RFC822 for details).toAddress - the receivers' mail addresses.ccAddress - the addresses to receive carbon copy of this message.bccAddress - the addresses to receive blind carbon copy of this
message.subject - the subject of the mail.messageBody - the mail body as text.
LogException - if the addresses cannot be parsed or other problems
in setting the data.
public void sendMail(javax.mail.internet.InternetAddress fromAddress,
javax.mail.internet.InternetAddress[] replyToAddress,
javax.mail.internet.InternetAddress senderAddress,
javax.mail.internet.InternetAddress[] toAddress,
javax.mail.internet.InternetAddress[] ccAddress,
javax.mail.internet.InternetAddress[] bccAddress,
String subject,
String messageBody,
String encoding)
throws LogException
MailSender
sendMail in interface MailSenderfromAddress - the sender's mail address.replyToAddress - reply to addresses (see RFC822 for details).senderAddress - sender addresses (see RFC822 for details).toAddress - the receivers' mail addresses.ccAddress - the addresses to receive carbon copy of this message.bccAddress - the addresses to receive blind carbon copy of this
message.subject - the subject of the mail.messageBody - the mail body as text.encoding - the charset to be applied.
LogException - if the addresses cannot be parsed or other problems
in setting the data.public void run()
run in interface Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||