|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.misc.EMailSender
EMailSender is a class that hides the details of sending email through an SMTP server using the JavaMail API and the Java Activation framework (JAF). This class logs using the log4j category "expresso.core.misc.EMailSender" (info, error, debug) This class uses a DB-context property, mailDebug=Y to dump SMTP debug on the console
default number of retries = 0; Creation date: (2/6/01 2:09:18 PM)
| Field Summary | |
protected List |
attachments
|
protected List |
dataSourceAttachments
|
protected String |
dbName
|
protected String |
from
|
protected String |
host
|
protected boolean |
htmlFormat
|
protected String |
password
|
protected String |
personal
|
protected String |
subject
|
protected String |
text
|
protected String |
to
|
protected String |
user
|
| Constructor Summary | |
EMailSender()
EMailSender constructor |
|
| Method Summary | |
void |
addDataSourceAttachment(ByteArrayDataSource dataSource)
This method adds an attachment to the email to be sent. |
void |
addDataSourceAttachments(List dataSourceList)
This method accepts a list of byte array data source collection to be sent as attachments. |
void |
addFileAttachment(String name)
This method adds an attachment to the email to be sent. |
void |
addFileAttachments(Vector fileNames)
This method provides a Vector of String names of files to be sent as attachments |
String |
getDBName()
This method returns the name of the DB context, either preset by the caller, or "default" if not set. |
String |
getPersonal()
This method sets the address to be used in the From header |
void |
send()
This method does all the dirty work of actually sending the email. |
void |
send(String to,
String subject,
String text)
This is a convinience method to wrap the send() method. |
void |
setConnectRetryDelay(long connectRetryDelay)
Sets the connectRetryDelay. |
void |
setDBName(String newDBName)
This method sets the DB context name, used for looking up several Setup parameters |
void |
setEmailHtmlFormat()
Tells the EMail sender to send HTML mail only |
void |
setFromAddress(String from)
This method sets the address to be used in the From header |
void |
setMaxConnectRetries(int maxConnectRetries)
Sets the maxConnectRetries. |
void |
setPersonal(String personal)
This method sets the address to be used in the From header |
void |
setSMTPHost(String host)
This method sets the name of the SMTP server to use |
void |
setSMTPPassword(String password)
This method sets the SMTP password to use for authentication |
void |
setSMTPUser(String user)
This method sets the username to use for SMTP authentication |
void |
setSubject(String subject)
This method sets the value to use for the Subject header |
void |
setText(String text)
Thiis method sets the content string of the email message |
void |
setToAddress(String to)
This method sets the address to be used in the To header |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected String to
protected String from
protected String personal
protected String host
protected String user
protected String password
protected String subject
protected String text
protected String dbName
protected List attachments
protected List dataSourceAttachments
protected boolean htmlFormat
| Constructor Detail |
public EMailSender()
| Method Detail |
public void addFileAttachment(String name)
name - java.lang.String The fully-qualified name of a file to send as
attachment.public void addFileAttachments(Vector fileNames)
fileNames - java.util.Vector Vector of fully-qualified file-names (String)public void addDataSourceAttachment(ByteArrayDataSource dataSource)
dataSource - byte array data source object that represents
an virtual attachment with a known content type (MIME type).public void addDataSourceAttachments(List dataSourceList)
dataSourceList - a list of collection of byte array data
source objects that represents an virtual attachment with a
known content type (MIME type).public String getDBName()
public void send()
throws Exception
Exception - if the internet mailing service fails
public void send(String to,
String subject,
String text)
throws Exception
to - java.lang.String The address to send email tosubject - java.lang.String The subject of the messagetext - java.lang.String The text of the message to send
Exception - Propagated exception from the send() methodpublic void setDBName(String newDBName)
newDBName - String Name of DB contextpublic void setFromAddress(String from)
from - java.lang.String The from addresspublic void setEmailHtmlFormat()
public void setPersonal(String personal)
public String getPersonal()
public void setSMTPHost(String host)
host - java.lang.String Name of SMTP serverpublic void setSMTPPassword(String password)
password - java.lang.String SMTP password to use for authenticationpublic void setSMTPUser(String user)
user - java.lang.String Username for SMTP authenticationpublic void setSubject(String subject)
subject - java.lang.String The subject header contentspublic void setText(String text)
text - java.lang.String Email message contentpublic void setToAddress(String to)
to - java.lang.String The address to use in To headerpublic void setConnectRetryDelay(long connectRetryDelay)
connectRetryDelay - The connectRetryDelay to setpublic void setMaxConnectRetries(int maxConnectRetries)
maxConnectRetries - The maxConnectRetries to set
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||