|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--mx4j.tools.mail.SMTP
This MBean is meant to send a mail given certain situation. It may be used to listen to a monitor or timer and send a mail. To use it you need to add to your classpath the mail.jar from the JavaMail API and the activation.jar from the Java Activation Framework. Besides you need to configure all the required fields, at least the serverHost and To fields and if your server requires login also the serverUsername and serverPassword fields The subject and content fields are subject to keyword expansions, i.e. some keyworks put between $ signs will be exapnded this can be used to give a more informative message. The current available expansions are $date$ -> Current date formatted with locale format $time$ -> Current tim formatted with locale format $datetime$ -> Current date and time formatted with locale format $notification$ -> Notification type $observed$ -> ObjectName of the observed object $objectname$ -> This MBean's objectname
| Constructor Summary | |
SMTP()
|
|
| Method Summary | |
java.lang.String |
getBCC()
Gets a comma separated list of addresses set in the BCC field |
java.lang.String |
getCC()
Gets a comma separated list of addresses set in the CC field |
java.lang.String |
getContent()
Returns the content of the mail |
java.lang.String |
getFromAddress()
Gets the from address attached to mails |
java.lang.String |
getFromName()
Gets the from name presented on the mail |
java.lang.String |
getMimeType()
Gets the MIME type set to the mail |
java.lang.String |
getNotificationName()
Returns the notification which will trigger the mail sending |
ObjectName |
getObservedObject()
Gets the MBean's objectname which is being listened |
java.lang.String |
getServerHost()
Gets the server's host as name or IP |
int |
getServerPort()
Gets the server's port, by default is 25 |
java.lang.String |
getServerUsername()
Gets the username to log to the server |
java.lang.String |
getSubject()
Gets the mail subject |
int |
getTimeout()
Returns the timeout used when sending mails |
java.lang.String |
getTo()
Gets a comma separated list of addresses set in the TO field |
void |
handleNotification(Notification notification,
java.lang.Object handback)
|
boolean |
isLoginToServer()
Indicates whether login to the SMTP server will be attpemted |
void |
postDeregister()
|
void |
postRegister(java.lang.Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Gathers some basic data |
protected void |
registerListener()
|
void |
sendMail()
This will directly execute the send mail. |
void |
setBCC(java.lang.String bccAddresses)
Sets a comma separated list of address which will go in the BCC mail field |
void |
setCC(java.lang.String ccAddresses)
Sets a comma separated list of address which will go in the CC mail field |
void |
setContent(java.lang.String content)
Sets the content of the mail |
void |
setFromAddress(java.lang.String fromAddress)
Sets the form address set to mail |
void |
setFromName(java.lang.String fromName)
Sets the from name presented on the mail |
void |
setLoginToServer(boolean login)
Sets whether to login to the SMTP server |
void |
setMimeType(java.lang.String mimeType)
Sets the MIME type, by default it is text/plain |
void |
setNotificationName(java.lang.String notificationName)
Sets the notification name which will trigger the mail sending. |
void |
setObservedObject(ObjectName targetMBeanName)
Sets the observed object. |
void |
setServerHost(java.lang.String host)
Sets the server's host, it can be set as name or IP |
void |
setServerPassword(java.lang.String password)
Sets server's passowrd, use with setLoginToServer(true) and setServerUsername |
void |
setServerPort(int port)
Sets the server's port. |
void |
setServerUsername(java.lang.String username)
Sets server's username, use with setLoginToServer(true) |
void |
setSubject(java.lang.String subject)
Sets the mail's subject, by default is Empty subject. |
void |
setTimeout(int timeout)
Sets the send timeout, by default it is 10 secs |
void |
setTo(java.lang.String toAddresses)
Sets a comma separated list of address which will go in the TO mail field |
protected void |
unregisterListener()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SMTP()
| Method Detail |
public void handleNotification(Notification notification,
java.lang.Object handback)
handleNotification in interface NotificationListenerpublic void sendMail()
SMTPMBeansendMail in interface SMTPMBeanpublic java.lang.String getBCC()
SMTPMBeangetBCC in interface SMTPMBeanpublic void setBCC(java.lang.String bccAddresses)
SMTPMBeansetBCC in interface SMTPMBeanpublic void setCC(java.lang.String ccAddresses)
SMTPMBeansetCC in interface SMTPMBeanpublic java.lang.String getCC()
SMTPMBeangetCC in interface SMTPMBeanpublic java.lang.String getFromAddress()
SMTPMBeangetFromAddress in interface SMTPMBeanpublic void setFromAddress(java.lang.String fromAddress)
SMTPMBeansetFromAddress in interface SMTPMBeanpublic void setServerHost(java.lang.String host)
SMTPMBeansetServerHost in interface SMTPMBeanpublic java.lang.String getServerHost()
SMTPMBeangetServerHost in interface SMTPMBeanpublic void setServerPort(int port)
SMTPMBeansetServerPort in interface SMTPMBeanpublic int getServerPort()
SMTPMBeangetServerPort in interface SMTPMBeanpublic void setServerUsername(java.lang.String username)
SMTPMBeansetServerUsername in interface SMTPMBeanpublic java.lang.String getServerUsername()
SMTPMBeangetServerUsername in interface SMTPMBeanpublic void setServerPassword(java.lang.String password)
SMTPMBeansetServerPassword in interface SMTPMBeanpublic void setLoginToServer(boolean login)
SMTPMBeansetLoginToServer in interface SMTPMBeanpublic boolean isLoginToServer()
SMTPMBeanisLoginToServer in interface SMTPMBeanpublic java.lang.String getFromName()
SMTPMBeangetFromName in interface SMTPMBeanpublic void setFromName(java.lang.String fromName)
SMTPMBeansetFromName in interface SMTPMBeanpublic java.lang.String getMimeType()
SMTPMBeangetMimeType in interface SMTPMBeanpublic void setMimeType(java.lang.String mimeType)
SMTPMBeansetMimeType in interface SMTPMBeanpublic java.lang.String getNotificationName()
SMTPMBeangetNotificationName in interface SMTPMBeanpublic void setNotificationName(java.lang.String notificationName)
SMTPMBeansetNotificationName in interface SMTPMBeanpublic java.lang.String getSubject()
SMTPMBeangetSubject in interface SMTPMBeanpublic void setSubject(java.lang.String subject)
SMTPMBeansetSubject in interface SMTPMBeanpublic java.lang.String getContent()
SMTPMBeangetContent in interface SMTPMBeanpublic void setContent(java.lang.String content)
SMTPMBeansetContent in interface SMTPMBeanpublic void setTimeout(int timeout)
SMTPMBeansetTimeout in interface SMTPMBeanpublic int getTimeout()
SMTPMBeangetTimeout in interface SMTPMBeanpublic void setObservedObject(ObjectName targetMBeanName)
SMTPMBeansetObservedObject in interface SMTPMBeanpublic ObjectName getObservedObject()
SMTPMBeangetObservedObject in interface SMTPMBeanpublic java.lang.String getTo()
SMTPMBeangetTo in interface SMTPMBeanpublic void setTo(java.lang.String toAddresses)
SMTPMBeansetTo in interface SMTPMBean
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws java.lang.Exception
preRegister in interface MBeanRegistrationpublic void postRegister(java.lang.Boolean registrationDone)
postRegister in interface MBeanRegistration
public void preDeregister()
throws java.lang.Exception
preDeregister in interface MBeanRegistrationpublic void postDeregister()
postDeregister in interface MBeanRegistrationprotected void registerListener()
protected void unregisterListener()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||