|
|||||||||
| Home >> All >> org >> mentawai >> [ mail overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.mentawai.mail
Class Email

java.lang.Objectorg.mentawai.mail.Email
- Direct Known Subclasses:
- MultiPartEmail, SimpleEmail
- public abstract class Email
- extends java.lang.Object
The base class for all email messages. This class sets the sender's email & name, receiver's email & name, subject, and the sent date. Subclasses are responsible for setting the message body.
- Version:
- $Revision: 1.3 $ $Date: 2005/07/29 21:23:15 $, $Id: Email.java,v 1.3 2005/07/29 21:23:15 soliveira Exp $
| Field Summary | |
static java.lang.String |
ATTACHMENTS
|
protected javax.mail.Authenticator |
authenticator
Instance of an Authenticator object that will be used
when authentication is requested from the mail server. |
protected java.util.List |
bccList
List of "bcc" email adresses |
protected java.lang.String |
bounceAddress
Address to which undeliverable mail should be sent. |
protected java.util.List |
ccList
List of "cc" email adresses |
protected java.lang.String |
charset
The charset to use for this message |
protected java.lang.Object |
content
The content |
static java.lang.String |
CONTENT_TYPE
|
protected java.lang.String |
contentType
The content type |
protected boolean |
debug
Set session debugging on or off |
private static java.lang.String |
def_bounce_email
|
private static java.lang.String |
def_charset
|
private static javax.mail.internet.InternetAddress |
def_from
|
private static java.lang.String |
def_hostname
|
private static java.lang.String |
def_password
|
private static java.lang.String |
def_username
|
static java.lang.String |
EMAIL_BODY
|
static java.lang.String |
EMAIL_SUBJECT
|
protected javax.mail.internet.MimeMultipart |
emailBody
An attachment |
static java.lang.String |
FILE_SERVER
|
protected javax.mail.internet.InternetAddress |
fromAddress
The Address of the sending party, mandatory |
protected java.util.Map |
headers
Used to specify the mail headers. |
protected java.lang.String |
hostName
The hostname of the mail server with which to connect. |
static java.lang.String |
ISO_8859_1
|
static java.lang.String |
KOI8_R
|
static java.lang.String |
MAIL_DEBUG
|
static java.lang.String |
MAIL_HOST
|
static java.lang.String |
MAIL_PORT
|
static java.lang.String |
MAIL_SMTP_AUTH
|
static java.lang.String |
MAIL_SMTP_FROM
|
static java.lang.String |
MAIL_TRANSPORT_PROTOCOL
|
protected javax.mail.internet.MimeMessage |
message
The email message to send. |
protected boolean |
popBeforeSmtp
Used to determine whether to use pop3 before smtp, and if so the settings. |
protected java.lang.String |
popHost
the host name of the pop3 server |
protected java.lang.String |
popPassword
the password to log into the pop3 server |
protected java.lang.String |
popUsername
the user name to log into the pop3 server |
static java.lang.String |
RECEIVER_EMAIL
|
static java.lang.String |
RECEIVER_NAME
|
protected java.util.List |
replyList
List of "replyTo" email adresses |
static java.lang.String |
SENDER_EMAIL
|
static java.lang.String |
SENDER_NAME
|
protected java.util.Date |
sentDate
Sent date |
private javax.mail.Session |
session
The Session to mail with |
static java.lang.String |
SMTP
|
protected java.lang.String |
smtpPort
The port number of the mail server to connect to. |
protected java.lang.String |
subject
The Subject |
static java.lang.String |
TEXT_HTML
|
static java.lang.String |
TEXT_PLAIN
|
protected java.util.List |
toList
List of "to" email adresses |
static java.lang.String |
US_ASCII
|
| Constructor Summary | |
Email()
|
|
| Method Summary | |
Email |
addBcc(java.lang.String email)
Add a blind BCC recipient to the email. |
Email |
addBcc(java.lang.String email,
java.lang.String name)
Add a blind BCC recipient to the email. |
Email |
addCc(java.lang.String email)
Add a recipient CC to the email. |
Email |
addCc(java.lang.String email,
java.lang.String name)
Add a recipient CC to the email. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds a header ( name, value ) to the headers Map. |
Email |
addReplyTo(java.lang.String email)
Add a reply to address to the email. |
Email |
addReplyTo(java.lang.String email,
java.lang.String name)
Add a reply to address to the email. |
Email |
addTo(java.lang.String email)
Add a recipient TO to the email. |
Email |
addTo(java.lang.String email,
java.lang.String name)
Add a recipient TO to the email. |
private static javax.mail.internet.InternetAddress |
createInternetAddress(java.lang.String email,
java.lang.String name,
java.lang.String charset)
Creates a InternetAddress. |
protected javax.mail.Session |
getMailSession()
Initialise a mailsession object |
java.util.Date |
getSentDate()
Gets the sent date for the email. |
void |
send()
Does the work of actually sending the email. |
void |
setAuthentication(java.lang.String userName,
java.lang.String password)
Sets the userName and password if authentication is needed. |
void |
setAuthenticator(javax.mail.Authenticator newAuthenticator)
Sets the Authenticator to be used when authentication
is requested from the mail server. |
Email |
setBcc(java.util.Collection aCollection)
Set a list of "BCC" addresses |
Email |
setBounceAddress(java.lang.String email)
Set the "bounce address" - the address to which undeliverable messages will be returned. |
Email |
setCc(java.util.Collection aCollection)
Set a list of "CC" addresses. |
void |
setCharset(java.lang.String newCharset)
Set the charset of the message. |
void |
setContent(javax.mail.internet.MimeMultipart aMimeMultipart)
Set the emailBody to a MimeMultiPart |
void |
setContent(java.lang.Object aObject,
java.lang.String aContentType)
Set the content & contentType |
void |
setDebug(boolean d)
Setting to true will enable the display of debug information. |
static void |
setDefaultAuthentication(java.lang.String user,
java.lang.String pass)
|
static void |
setDefaultBounceAddress(java.lang.String email)
|
static void |
setDefaultCharset(java.lang.String charset)
|
static void |
setDefaultFrom(java.lang.String email,
java.lang.String name)
|
static void |
setDefaultHostName(java.lang.String host)
|
Email |
setFrom(java.lang.String email)
Set the FROM field of the email. |
Email |
setFrom(java.lang.String email,
java.lang.String name)
Set the FROM field of the email. |
void |
setHeaders(java.util.Map map)
Used to specify the mail headers. |
void |
setHostName(java.lang.String aHostName)
Set the hostname of the outgoing mail server |
void |
setMailSession(javax.mail.Session aSession)
Supply a mail Session object to use |
abstract Email |
setMsg(java.lang.String msg)
Define the content of the mail. |
void |
setPopBeforeSmtp(boolean newPopBeforeSmtp,
java.lang.String newPopHost,
java.lang.String newPopUsername,
java.lang.String newPopPassword)
Set details regarding "pop3 before smtp" authentication. |
void |
setSentDate(java.util.Date date)
Sets the sent date for the email. |
void |
setSmtpPort(int aPortNumber)
Set the port number of the outgoing mail server. |
Email |
setSubject(java.lang.String aSubject)
Set the email subject. |
Email |
setTo(java.util.Collection aCollection)
Set a list of "TO" addresses. |
protected javax.mail.internet.InternetAddress[] |
toInternetAddressArray(java.util.List list)
Utility to copy List of known InternetAddress objects into an array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
SENDER_EMAIL
public static final java.lang.String SENDER_EMAIL
- See Also:
- Constant Field Values
SENDER_NAME
public static final java.lang.String SENDER_NAME
- See Also:
- Constant Field Values
RECEIVER_EMAIL
public static final java.lang.String RECEIVER_EMAIL
- See Also:
- Constant Field Values
RECEIVER_NAME
public static final java.lang.String RECEIVER_NAME
- See Also:
- Constant Field Values
EMAIL_SUBJECT
public static final java.lang.String EMAIL_SUBJECT
- See Also:
- Constant Field Values
EMAIL_BODY
public static final java.lang.String EMAIL_BODY
- See Also:
- Constant Field Values
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPE
- See Also:
- Constant Field Values
MAIL_HOST
public static final java.lang.String MAIL_HOST
- See Also:
- Constant Field Values
MAIL_PORT
public static final java.lang.String MAIL_PORT
- See Also:
- Constant Field Values
MAIL_SMTP_FROM
public static final java.lang.String MAIL_SMTP_FROM
- See Also:
- Constant Field Values
MAIL_SMTP_AUTH
public static final java.lang.String MAIL_SMTP_AUTH
- See Also:
- Constant Field Values
MAIL_TRANSPORT_PROTOCOL
public static final java.lang.String MAIL_TRANSPORT_PROTOCOL
- See Also:
- Constant Field Values
SMTP
public static final java.lang.String SMTP
- See Also:
- Constant Field Values
TEXT_HTML
public static final java.lang.String TEXT_HTML
- See Also:
- Constant Field Values
TEXT_PLAIN
public static final java.lang.String TEXT_PLAIN
- See Also:
- Constant Field Values
ATTACHMENTS
public static final java.lang.String ATTACHMENTS
- See Also:
- Constant Field Values
FILE_SERVER
public static final java.lang.String FILE_SERVER
- See Also:
- Constant Field Values
MAIL_DEBUG
public static final java.lang.String MAIL_DEBUG
- See Also:
- Constant Field Values
KOI8_R
public static final java.lang.String KOI8_R
- See Also:
- Constant Field Values
ISO_8859_1
public static final java.lang.String ISO_8859_1
- See Also:
- Constant Field Values
US_ASCII
public static final java.lang.String US_ASCII
- See Also:
- Constant Field Values
message
protected javax.mail.internet.MimeMessage message
- The email message to send.
charset
protected java.lang.String charset
- The charset to use for this message
fromAddress
protected javax.mail.internet.InternetAddress fromAddress
- The Address of the sending party, mandatory
subject
protected java.lang.String subject
- The Subject
emailBody
protected javax.mail.internet.MimeMultipart emailBody
- An attachment
content
protected java.lang.Object content
- The content
contentType
protected java.lang.String contentType
- The content type
debug
protected boolean debug
- Set session debugging on or off
sentDate
protected java.util.Date sentDate
- Sent date
authenticator
protected javax.mail.Authenticator authenticator
- Instance of an
Authenticatorobject that will be used when authentication is requested from the mail server.
hostName
protected java.lang.String hostName
- The hostname of the mail server with which to connect. If null will try
to get property from system.properties. If still null, quit
smtpPort
protected java.lang.String smtpPort
- The port number of the mail server to connect to.
Defaults to the standard port ( 25 ).
toList
protected java.util.List toList
- List of "to" email adresses
ccList
protected java.util.List ccList
- List of "cc" email adresses
bccList
protected java.util.List bccList
- List of "bcc" email adresses
replyList
protected java.util.List replyList
- List of "replyTo" email adresses
bounceAddress
protected java.lang.String bounceAddress
- Address to which undeliverable mail should be sent.
Because this is handled by JavaMail as a String property
in the mail session, this property is of type
Stringrather thanInternetAddress.
headers
protected java.util.Map headers
- Used to specify the mail headers. Example:
X-Mailer: Sendmail, X-Priority: 1( highest )
or 2( high ) 3( normal ) 4( low ) and 5( lowest )
Disposition-Notification-To: user@domain.net
popBeforeSmtp
protected boolean popBeforeSmtp
- Used to determine whether to use pop3 before smtp, and if so the settings.
popHost
protected java.lang.String popHost
- the host name of the pop3 server
popUsername
protected java.lang.String popUsername
- the user name to log into the pop3 server
popPassword
protected java.lang.String popPassword
- the password to log into the pop3 server
session
private javax.mail.Session session
- The Session to mail with
def_username
private static java.lang.String def_username
def_password
private static java.lang.String def_password
def_hostname
private static java.lang.String def_hostname
def_bounce_email
private static java.lang.String def_bounce_email
def_from
private static javax.mail.internet.InternetAddress def_from
def_charset
private static java.lang.String def_charset
| Constructor Detail |
public Email()
| Method Detail |
setDefaultCharset
public static void setDefaultCharset(java.lang.String charset)
setDefaultAuthentication
public static void setDefaultAuthentication(java.lang.String user, java.lang.String pass)
setDefaultHostName
public static void setDefaultHostName(java.lang.String host)
setDefaultFrom
public static void setDefaultFrom(java.lang.String email, java.lang.String name)
setDefaultBounceAddress
public static void setDefaultBounceAddress(java.lang.String email)
setDebug
public void setDebug(boolean d)
- Setting to true will enable the display of debug information.
setAuthentication
public void setAuthentication(java.lang.String userName, java.lang.String password)
- Sets the userName and password if authentication is needed. If this
method is not used, no authentication will be performed.
This method will create a new instance of
DefaultAuthenticatorusing the supplied parameters.
setAuthenticator
public void setAuthenticator(javax.mail.Authenticator newAuthenticator)
- Sets the
Authenticatorto be used when authentication is requested from the mail server.This method should be used when your outgoing mail server requires authentication. Your mail server must also support RFC2554.
setCharset
public void setCharset(java.lang.String newCharset)
- Set the charset of the message.
setContent
public void setContent(javax.mail.internet.MimeMultipart aMimeMultipart)
- Set the emailBody to a MimeMultiPart
setContent
public void setContent(java.lang.Object aObject, java.lang.String aContentType)
- Set the content & contentType
setHostName
public void setHostName(java.lang.String aHostName)
- Set the hostname of the outgoing mail server
setSmtpPort
public void setSmtpPort(int aPortNumber)
- Set the port number of the outgoing mail server.
setMailSession
public void setMailSession(javax.mail.Session aSession)
- Supply a mail Session object to use
getMailSession
protected javax.mail.Session getMailSession() throws EmailException
- Initialise a mailsession object
createInternetAddress
private static javax.mail.internet.InternetAddress createInternetAddress(java.lang.String email, java.lang.String name, java.lang.String charset) throws EmailException
- Creates a InternetAddress.
setFrom
public Email setFrom(java.lang.String email) throws EmailException
- Set the FROM field of the email.
setFrom
public Email setFrom(java.lang.String email, java.lang.String name) throws EmailException
- Set the FROM field of the email.
addTo
public Email addTo(java.lang.String email) throws EmailException
- Add a recipient TO to the email.
addTo
public Email addTo(java.lang.String email, java.lang.String name) throws EmailException
- Add a recipient TO to the email.
setTo
public Email setTo(java.util.Collection aCollection) throws EmailException
- Set a list of "TO" addresses.
addCc
public Email addCc(java.lang.String email) throws EmailException
- Add a recipient CC to the email.
addCc
public Email addCc(java.lang.String email, java.lang.String name) throws EmailException
- Add a recipient CC to the email.
setCc
public Email setCc(java.util.Collection aCollection) throws EmailException
- Set a list of "CC" addresses.
addBcc
public Email addBcc(java.lang.String email) throws EmailException
- Add a blind BCC recipient to the email.
addBcc
public Email addBcc(java.lang.String email, java.lang.String name) throws EmailException
- Add a blind BCC recipient to the email.
setBcc
public Email setBcc(java.util.Collection aCollection) throws EmailException
- Set a list of "BCC" addresses
addReplyTo
public Email addReplyTo(java.lang.String email) throws EmailException
- Add a reply to address to the email.
addReplyTo
public Email addReplyTo(java.lang.String email, java.lang.String name) throws EmailException
- Add a reply to address to the email.
setHeaders
public void setHeaders(java.util.Map map)
- Used to specify the mail headers. Example:
X-Mailer: Sendmail, X-Priority: 1( highest )
or 2( high ) 3( normal ) 4( low ) and 5( lowest )
Disposition-Notification-To: user@domain.net
addHeader
public void addHeader(java.lang.String name, java.lang.String value)
- Adds a header ( name, value ) to the headers Map.
setSubject
public Email setSubject(java.lang.String aSubject)
- Set the email subject.
setBounceAddress
public Email setBounceAddress(java.lang.String email)
- Set the "bounce address" - the address to which undeliverable messages
will be returned. If this value is never set, then the message will be
sent to the address specified with the System property "mail.smtp.from",
or if that value is not set, then to the "from" address.
setMsg
public abstract Email setMsg(java.lang.String msg) throws EmailException
- Define the content of the mail. It should be overidden by the
subclasses.
send
public void send()
throws EmailException
- Does the work of actually sending the email.
setSentDate
public void setSentDate(java.util.Date date)
- Sets the sent date for the email. The sent date will default to the
current date if not explictly set.
getSentDate
public java.util.Date getSentDate()
- Gets the sent date for the email.
toInternetAddressArray
protected javax.mail.internet.InternetAddress[] toInternetAddressArray(java.util.List list)
- Utility to copy List of known InternetAddress objects into an
array.
setPopBeforeSmtp
public void setPopBeforeSmtp(boolean newPopBeforeSmtp,
java.lang.String newPopHost,
java.lang.String newPopUsername,
java.lang.String newPopPassword)
- Set details regarding "pop3 before smtp" authentication.
|
|||||||||
| Home >> All >> org >> mentawai >> [ mail overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.mentawai.mail.Email