com.raritantechnologies.utils.email
Class SimpleSMTPMailer

java.lang.Object
  extended bycom.raritantechnologies.utils.email.SimpleSMTPMailer
All Implemented Interfaces:
IConfigurable, IMailer

public class SimpleSMTPMailer
extends java.lang.Object
implements IMailer

System Object class that implements a very simple SMTP interface for mail enabling applications. XML Configuration Template:

   <SystemObject type="SimpleSMTPMailer" 
   	configurableClass="com.raritantechnologies.utils.email.SimpleSMTPMailer"
		name="[unique name for this SMTPMailer]"
		mailServer="[IP Address of mail server]"
		mailServerPort="[Port of mail server (default is 25)]"
		userID="[User ID for SMTP server authentication]"
		password="[Password for SMTP server authentication]"
		authenticationRequired="true (default)|false"
		messageTemplateFile="[Location of optional message template file]"
	>
		<MessageTemplates>
			<MessageTemplate name="[user defined name of template]">
				Your e-mail message here
			</MessageTemplate>
		</MessageTemplates>
		<MailRecipients>
			<MailRecipient address="[email address of message recipient]">
		</MailRecipients>
  </SystemObject>
 

Developed by Raritan Technologies Inc..

Author:
Bill Ellis

Constructor Summary
SimpleSMTPMailer()
           
 
Method Summary
 ConfigurationManager getConfigurationManager()
           
 java.lang.String getMsgTemplate(java.lang.String name)
           
 java.lang.String getMsgTemplateFile()
           
 java.lang.String getName()
           
 java.lang.String getPassword()
           
 java.util.ArrayList getRecipientList()
           
 java.lang.String getType()
           
 java.lang.String getUserID()
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 boolean isAuthenticationRequired()
           
static void main(java.lang.String[] args)
          Main program for testing SimpleSMTPMailer from command line
 boolean sendMail(java.lang.String msgStr)
           
 boolean sendMail(java.lang.String msgStr, java.lang.String subject)
          Sends an email to the recipients.
 boolean sendMail(java.lang.String msgStr, java.lang.String subject, java.lang.String contentType)
          Sends an email to the recipients.
 void setAuthenticationRequired(boolean authRequired)
           
 void setAuthenticationRequired(java.lang.String authRequired)
           
static void setDEBUG(boolean debug)
           
static void setDEBUG(java.lang.String debug)
           
 void setMsgTemplate(java.util.HashMap msgTemplate)
           
 void setMsgTemplate(java.lang.String name, java.lang.String msgTemplateText)
           
 void setMsgTemplateFile(java.lang.String msgTemplateFile)
           
 void setName(java.lang.String name)
           
 void setPassword(java.lang.String password)
           
 void setRecipientList(java.util.ArrayList recipList)
           
 void setRecipientList(java.lang.String recipient)
          Sets the recipient list to one recipient.
 void setRecipientList(java.lang.String[] recipList)
           
 void setType(java.lang.String type)
           
 void setUserID(java.lang.String userID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSMTPMailer

public SimpleSMTPMailer()
Method Detail

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IMailer

getUserID

public java.lang.String getUserID()
Specified by:
getUserID in interface IMailer

setUserID

public void setUserID(java.lang.String userID)
Specified by:
setUserID in interface IMailer

getPassword

public java.lang.String getPassword()
Specified by:
getPassword in interface IMailer

setPassword

public void setPassword(java.lang.String password)
Specified by:
setPassword in interface IMailer

getType

public java.lang.String getType()
Specified by:
getType in interface IMailer

getRecipientList

public java.util.ArrayList getRecipientList()
Specified by:
getRecipientList in interface IMailer

setRecipientList

public void setRecipientList(java.lang.String recipient)
Description copied from interface: IMailer
Sets the recipient list to one recipient.

Specified by:
setRecipientList in interface IMailer
Parameters:
recipient - The receivers email address.

setRecipientList

public void setRecipientList(java.lang.String[] recipList)
Specified by:
setRecipientList in interface IMailer

setRecipientList

public void setRecipientList(java.util.ArrayList recipList)
Specified by:
setRecipientList in interface IMailer

setType

public void setType(java.lang.String type)
Specified by:
setType in interface IMailer

getName

public java.lang.String getName()
Specified by:
getName in interface IMailer

getConfigurationManager

public ConfigurationManager getConfigurationManager()

setName

public void setName(java.lang.String name)
Specified by:
setName in interface IMailer

getMsgTemplateFile

public java.lang.String getMsgTemplateFile()
Specified by:
getMsgTemplateFile in interface IMailer

setMsgTemplateFile

public void setMsgTemplateFile(java.lang.String msgTemplateFile)
Specified by:
setMsgTemplateFile in interface IMailer

getMsgTemplate

public java.lang.String getMsgTemplate(java.lang.String name)
Specified by:
getMsgTemplate in interface IMailer

setMsgTemplate

public void setMsgTemplate(java.lang.String name,
                           java.lang.String msgTemplateText)
Specified by:
setMsgTemplate in interface IMailer

setMsgTemplate

public void setMsgTemplate(java.util.HashMap msgTemplate)
Specified by:
setMsgTemplate in interface IMailer

isAuthenticationRequired

public boolean isAuthenticationRequired()

setAuthenticationRequired

public void setAuthenticationRequired(java.lang.String authRequired)
Specified by:
setAuthenticationRequired in interface IMailer

setAuthenticationRequired

public void setAuthenticationRequired(boolean authRequired)
Specified by:
setAuthenticationRequired in interface IMailer

setDEBUG

public static void setDEBUG(java.lang.String debug)

setDEBUG

public static void setDEBUG(boolean debug)

sendMail

public boolean sendMail(java.lang.String msgStr,
                        java.lang.String subject,
                        java.lang.String contentType)
Description copied from interface: IMailer
Sends an email to the recipients.

Specified by:
sendMail in interface IMailer
Parameters:
msgStr - The message body of the email.
subject - The email Subject header
contentType - The content type of the message (e.g. 'text/html' or 'text/plain'

sendMail

public boolean sendMail(java.lang.String msgStr)
Specified by:
sendMail in interface IMailer

sendMail

public boolean sendMail(java.lang.String msgStr,
                        java.lang.String subject)
Description copied from interface: IMailer
Sends an email to the recipients.

Specified by:
sendMail in interface IMailer
Parameters:
msgStr - The message body of the email.
subject - The email Subject header

main

public static void main(java.lang.String[] args)
Main program for testing SimpleSMTPMailer from command line