|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quadrique.jbuildingblocks.core.io.email.JbbEmail
public class JbbEmail
| Field Summary | |
|---|---|
static String |
CONTENT_TRANSFER_ENCODING_HEADER
the "Content-Transfer-Encoding" header value as defined by RFC 2045 should be of the form: "Content-Transfer-Encoding : 8Bit" |
static String |
CONTENT_TRANSFER_ENCODING_HEADER_VALUE
the "Content-Transfer-Encoding" header value as defined by RFC 2045 should be of the form: "Content-Transfer-Encoding : 8Bit" |
static String |
CONTENT_TYPE_IS_HTML_ISO_LATIN_1
the "Content-Type" header value as defined by RFC 2045 should be of the form: Content-Type: text/html; charset="iso-8859-1" |
static String |
CONTENT_TYPE_IS_PLAIN_TEXT_ISO_LATIN_1
the "Content-Type" header value as defined by RFC 2045 should be of the form: Content-Type: text/plain; charset="iso-8859-1" |
| Method Summary | |
|---|---|
void |
closePOP3Connection()
This must be called once all interaction with the POP3 server and its messages has been completed. |
String |
convertEmailAddressListFromArrayListToString(ArrayList<String> liste)
|
ArrayList<String> |
convertEmailAddressListFromStringToArrayList(String liste)
To convert from a String which contains a semicolon separated list of email addresses to an ArrayList<String> instance which contains the individual email addresses (if any) |
ArrayList<String> |
getBcc()
|
DataSource |
getBody()
|
ArrayList<String> |
getCc()
|
String |
getFrom()
|
javax.mail.Session |
getSession()
|
String |
getSubject()
|
ArrayList<String> |
getTo()
|
boolean |
isValidateEmailAddresses()
|
void |
isValidEmailAddress(String emailAddress)
To validate the syntax of an email address |
void |
isValidEmailAddressList(ArrayList<String> emailAddressList,
boolean emptyAllowed)
To validate the syntax of a list of email address |
void |
isValidEmailAddressList(String emailAddressList,
boolean emptyAllowed)
To validate the syntax of a list of email address |
static JbbEmail |
newInstance()
The one and only entry point to get this object |
void |
openPOP3Connection()
Before doing anything with a POP3 server, call this method to establish the connection. |
ArrayList<javax.mail.Message> |
retrieveEmailFromPOP3Server(boolean leaveCopyOnServer)
Retrieve email messages from a POP3 server |
void |
sendEmail()
|
void |
sendEmailHtmlWithEmbeddedImages(HashMap<String,File> images)
HTML email messages with image links (e.g. |
void |
sendEmailWithAttachments(ArrayList<File> files)
|
void |
setBcc(ArrayList<String> bcc)
To set the value of the 'bcc' field |
void |
setBcc(String bcc)
To set the value of the 'bcc' field from a semicolon separated list of email addresses. |
void |
setBody(DataSource body)
To set the body of the email |
void |
setBody(File body,
String contentType)
To set the body of the email from the content of a file. |
void |
setBody(String body,
String contentType)
To set the body of the email from the content of a String. |
void |
setBodyHtml(File body)
To set the body of the email from the content of a file The file content is assumed to be HTML. |
void |
setBodyHtml(String body)
To set the body of the email from the content of a String The String content is assumed to be HTML. |
void |
setBodyPlainText(File body)
To set the body of the email from the content of a file The file content is assumed to be plain text. |
void |
setBodyPlainText(String body)
To set the body of the email from the content of a String The String content is assumed to be plain text. |
void |
setCc(ArrayList<String> cc)
To set the value of the 'cc' field |
void |
setCc(String cc)
To set the value of the 'cc' field from a semicolon separated list of email addresses. |
void |
setFrom(String from)
|
void |
setSession(JbbEmailSessionConfig config)
To create a Session from the address of a smtp server |
void |
setSession(javax.mail.Session session)
|
void |
setSubject(String subject)
|
void |
setTo(ArrayList<String> to)
To set the value of the 'to' field |
void |
setTo(String to)
To set the value of the 'to' field from a semicolon separated list of email addresses. |
void |
setValidateEmailAddresses(boolean emailAddressValidation)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONTENT_TYPE_IS_PLAIN_TEXT_ISO_LATIN_1
public static final String CONTENT_TYPE_IS_HTML_ISO_LATIN_1
public static final String CONTENT_TRANSFER_ENCODING_HEADER
public static final String CONTENT_TRANSFER_ENCODING_HEADER_VALUE
| Method Detail |
|---|
public static JbbEmail newInstance()
public void setSession(JbbEmailSessionConfig config)
throws Exception
config - the address of a server and more
Exception
public void setSession(javax.mail.Session session)
throws Exception
session - The session to set.
Exception
public void isValidEmailAddress(String emailAddress)
throws Exception
emailAddress - the email address to validate (e.g. "support@quadrique.com")
Exception - if the email address is not valid
public void isValidEmailAddressList(String emailAddressList,
boolean emptyAllowed)
throws Exception
emailAddressList - a semicolon separated list of email addresses (e.g. "sales@quadrique.com;support@quadrique.com")emptyAllowed - if false, an exception will be thrown if the list is empty
Exception
public void isValidEmailAddressList(ArrayList<String> emailAddressList,
boolean emptyAllowed)
throws Exception
emailAddressList - a ArrayList<String> instanceemptyAllowed - if false, an exception will be thrown if the list is empty
Exception
public ArrayList<String> convertEmailAddressListFromStringToArrayList(String liste)
throws Exception
liste - a semicolon separated list of email addresses (e.g. "sales@quadrique.com;support@quadrique.com")
Exception
public void setTo(ArrayList<String> to)
throws Exception
to - a list of email address. Please note that only one email address is required and that multiple email addresses are supported.
Exception
public void setTo(String to)
throws Exception
to - a semicolon separated list of email addresses (e.g. "support@quadrique.com" or "support@quadrique.com;sales@quadrique.com") Exception
public void setCc(ArrayList<String> cc)
throws Exception
cc - a list of email addresses.
Exception
public void setCc(String cc)
throws Exception
cc - a semicolon separated list of email addresses (e.g. "support@quadrique.com" or "support@quadrique.com;sales@quadrique.com")
Exception
public void setBcc(ArrayList<String> bcc)
throws Exception
bcc - a list of email addresses.
Exception
public void setBcc(String bcc)
throws Exception
bcc - a semicolon separated list of email addresses (e.g. "support@quadrique.com" or "support@quadrique.com;sales@quadrique.com")
Exceptionpublic void setBody(DataSource body)
body - a DataSource isntance
public void setBodyPlainText(File body)
throws Exception
body - the file
Exception
public void setBodyHtml(File body)
throws Exception
body - the file
Exception
public void setBody(File body,
String contentType)
throws Exception
contentType - the content type of the file (e.g. "text/html; charset="iso-8859-1"").body - the file
Exception
public void setBodyHtml(String body)
throws Exception
body - the String
Exception
public void setBodyPlainText(String body)
throws Exception
body - the String
Exception
public void setBody(String body,
String contentType)
throws Exception
contentType - the content type of the String (e.g. "text/html; charset="iso-8859-1"").body - the String
Exception
public void setFrom(String from)
throws Exception
from - The 'from' address to use
Exceptionpublic String getFrom()
public void sendEmail()
throws Exception
Exception
public void sendEmailWithAttachments(ArrayList<File> files)
throws Exception
files -
Exception
public void sendEmailHtmlWithEmbeddedImages(HashMap<String,File> images)
throws Exception
)
are considered harmful and tend to be blocked by default by most anti-virus programs (it's an easy
way for a spammer to determine if your email is valid and if you are reading your emails :)).
The following method allows to send HTML emails with embedded images.
Here is a sample code snippet:
emailHandler.setBodyHtml("Here is an image:
");
HashMap
where "cid" stands for content id and "image1" refers to the key in the HashMap
images -
Exception
public ArrayList<String> getBcc()
public DataSource getBody()
public ArrayList<String> getCc()
public javax.mail.Session getSession()
public String getSubject()
public void setSubject(String subject)
subject - The subject to set.public ArrayList<String> getTo()
public boolean isValidateEmailAddresses()
public void setValidateEmailAddresses(boolean emailAddressValidation)
emailAddressValidation - The emailAddressValidation to set.
public String convertEmailAddressListFromArrayListToString(ArrayList<String> liste)
throws Exception
liste -
Exception
public void openPOP3Connection()
throws Exception
Exception
public void closePOP3Connection()
throws Exception
Exception
public ArrayList<javax.mail.Message> retrieveEmailFromPOP3Server(boolean leaveCopyOnServer)
throws Exception
leaveCopyOnServer - Set to true if the messages should be left on the server
ExceptionopenPOP3Connection(),
closePOP3Connection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||