org.openeai.loggingutils
Class MailService

java.lang.Object
  extended by org.openeai.loggingutils.MailService

public class MailService
extends java.lang.Object

MailService class. Common re-usable class for sending email messages. Uses JavaMail and Java Activation Frameworks

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)

Constructor Summary
MailService()
           
MailService(MailServiceConfig config)
          As AppConfig reads through an application's deployment document, it will build a MailServiceConfig Java object and pass that object to this constructor.
MailService(java.lang.String mailHost, java.lang.String fromAddr)
           
MailService(java.lang.String mailHost, java.lang.String fromAddr, java.lang.String toAddr)
           
MailService(java.lang.String toAddr, java.lang.String fromAddr, java.lang.String subject, java.lang.String msg)
           
 
Method Summary
 javax.mail.internet.InternetAddress getFromAddr()
          Deprecated. As of OpenEAI 4.0 release, use getFromAddress() instead.
 javax.mail.internet.InternetAddress getFromAddress()
          returns the from address class variable
 java.lang.String getMailHost()
          returns the value of the mail host class variable
 java.lang.String getMessageBody()
          returns the message body of the current message
 java.lang.String getMsgText()
          Deprecated. As of OpenEAI 4.0 release, use getMessageBody() instead.
 javax.mail.internet.InternetAddress[] getRecipientList()
          Returns the to address class variable
 javax.mail.internet.InternetAddress getRecpient(int index)
          Returns a specific email address from the toAddr InternetAddress array
 java.lang.String getSubject()
          returns the subject of the current message
 javax.mail.internet.InternetAddress[] getToAddr()
          Deprecated. As of OpenEAI 4.0 release, use getRecipientList() instead.
 javax.mail.internet.InternetAddress getToAddr(int index)
          Deprecated. As of OpenEAI 4.0 release, use getRecipientList(int) instead.
 boolean sendHTMLMessage()
          Sends an HTML email message to everyone included in the toAddr class variable.
 boolean sendMessage()
          Sends an email message to everyone included in the toAddr class variable.
 void setFromAddr(java.lang.String fromAddr)
          Deprecated. As of OpenEAI 4.0 release, use setFromAddress() instead.
 void setFromAddress(java.lang.String fromAddr)
          Sets the fromAddr variable to the data passed in
 void setMailHost(java.lang.String mailHost)
          Sets the mailHost class variable to the data passed in
 void setMessageBody(java.lang.String msg)
          sets the msgText variable to data passed from the client.
 void setMsgText(java.lang.String msg)
          Deprecated. As of OpenEAI 4.0 release, use setMessageBody(String) instead.
 void setRecipientList(java.lang.String addr)
          Sets the toAddr variable to the data passed in
 void setSubject(java.lang.String subject)
          sets the subject class variable to data passed in from the client
 void setToAddr(java.lang.String addr)
          Deprecated. As of OpenEAI 4.0 release, use setRecipientList(String) instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailService

public MailService(MailServiceConfig config)
            throws javax.mail.internet.AddressException
As AppConfig reads through an application's deployment document, it will build a MailServiceConfig Java object and pass that object to this constructor. Then this MailService object will have all the information it needs to initialize itself.

Parameters:
config - org.openeai.config.MailServiceConfig
Throws:
javax.mail.internet.AddressException
See Also:
MailServiceConfig, MailService

MailService

public MailService()

MailService

public MailService(java.lang.String toAddr,
                   java.lang.String fromAddr,
                   java.lang.String subject,
                   java.lang.String msg)
            throws javax.mail.internet.AddressException
Throws:
javax.mail.internet.AddressException

MailService

public MailService(java.lang.String mailHost,
                   java.lang.String fromAddr)
            throws javax.mail.internet.AddressException
Throws:
javax.mail.internet.AddressException

MailService

public MailService(java.lang.String mailHost,
                   java.lang.String fromAddr,
                   java.lang.String toAddr)
            throws javax.mail.internet.AddressException
Throws:
javax.mail.internet.AddressException
Method Detail

sendMessage

public boolean sendMessage()
Sends an email message to everyone included in the toAddr class variable.

Returns:
boolean True if successful, false if an error occurs

sendHTMLMessage

public boolean sendHTMLMessage()
Sends an HTML email message to everyone included in the toAddr class variable.

Returns:
boolean True if successful, false if an error occurs

setMailHost

public void setMailHost(java.lang.String mailHost)
Sets the mailHost class variable to the data passed in

Parameters:
mailHost - mail host set by the calling client

setToAddr

public void setToAddr(java.lang.String addr)
               throws javax.mail.internet.AddressException
Deprecated. As of OpenEAI 4.0 release, use setRecipientList(String) instead.

Sets the toAddr class variable to the data passed in

Parameters:
addr - String coma separated list of email addresses to send messages to set by the client
Throws:
javax.mail.internet.AddressException

setRecipientList

public void setRecipientList(java.lang.String addr)
                      throws javax.mail.internet.AddressException
Sets the toAddr variable to the data passed in

Parameters:
addr - String coma separated list of email addresses to send messages to set by the client
Throws:
javax.mail.internet.AddressException

setFromAddr

public void setFromAddr(java.lang.String fromAddr)
                 throws javax.mail.internet.AddressException
Deprecated. As of OpenEAI 4.0 release, use setFromAddress() instead.

Sets the fromAddr class variable to the data passed in

Parameters:
fromAddr - Address that messages are coming from
Throws:
javax.mail.internet.AddressException

setFromAddress

public void setFromAddress(java.lang.String fromAddr)
                    throws javax.mail.internet.AddressException
Sets the fromAddr variable to the data passed in

Parameters:
fromAddr - Address that messages are coming from
Throws:
javax.mail.internet.AddressException

setSubject

public void setSubject(java.lang.String subject)
sets the subject class variable to data passed in from the client

Parameters:
subject - subject of the message passed from the client

setMsgText

public void setMsgText(java.lang.String msg)
Deprecated. As of OpenEAI 4.0 release, use setMessageBody(String) instead.

sets the msgText class variable to data passed from the client.

Parameters:
msg - String message to be sent

setMessageBody

public void setMessageBody(java.lang.String msg)
sets the msgText variable to data passed from the client.

Parameters:
msg - String message to be sent

getMailHost

public java.lang.String getMailHost()
returns the value of the mail host class variable

Returns:
String.mail host

getToAddr

public javax.mail.internet.InternetAddress[] getToAddr()
Deprecated. As of OpenEAI 4.0 release, use getRecipientList() instead.

Returns the to address class variable

Returns:
InternetAddress[] email addresses of the recipients of a message

getRecipientList

public javax.mail.internet.InternetAddress[] getRecipientList()
Returns the to address class variable

Returns:
InternetAddress[] email addresses of the recipients of a message

getToAddr

public javax.mail.internet.InternetAddress getToAddr(int index)
Deprecated. As of OpenEAI 4.0 release, use getRecipientList(int) instead.

Returns a specific email address from the toAddr InternetAddress array

Returns:
InternetAddress an email address from the toAddr array

getRecpient

public javax.mail.internet.InternetAddress getRecpient(int index)
Returns a specific email address from the toAddr InternetAddress array

Returns:
InternetAddress an email address from the toAddr array

getFromAddr

public javax.mail.internet.InternetAddress getFromAddr()
Deprecated. As of OpenEAI 4.0 release, use getFromAddress() instead.

returns the from address class variable

Returns:
InternetAddress email address of the sender of the message

getFromAddress

public javax.mail.internet.InternetAddress getFromAddress()
returns the from address class variable

Returns:
InternetAddress email address of the sender of the message

getSubject

public java.lang.String getSubject()
returns the subject of the current message

Returns:
String subject of the email message

getMsgText

public java.lang.String getMsgText()
Deprecated. As of OpenEAI 4.0 release, use getMessageBody() instead.

returns the message text of the current message

Returns:
String message text

getMessageBody

public java.lang.String getMessageBody()
returns the message body of the current message

Returns:
String message body


Copyright © 2002,2003 OpenEAI Software Foundation