|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.email.Email
public class Email
is a class for constructing and sending emails. The class is capable of plain text mails, HTML mails, HTML mails with inline images, alternative content mails (text + HTML) and adding attachments to any of the former.
| Constructor Summary | |
|---|---|
Email()
creates and configures a new Email. |
|
Email(EmailConfiguration conf)
creates a new Email from the given configuration without initialising the email body. |
|
Email(EmailConfiguration conf,
org.jdom.Document d)
creates a new Email from the given configuration and the given XML document. |
|
Email(EmailConfiguration conf,
org.jdom.Element e)
creates a new Email from the given configuration and the given XML element. |
|
Email(EmailConfiguration conf,
java.lang.Object jaxbAble)
creates a new Email from the given configuration and the given JAXB enabled object. |
|
| Method Summary | |
|---|---|
javax.mail.internet.MimeMessage |
asMimeMessage(javax.mail.Session session)
returns the Email as a MimeMessage. |
void |
clearAttachments()
clears the attachments. |
void |
clearInlineImages()
clears the inline images. |
protected java.lang.String |
getReturnPath()
returns the return-path address as a string. |
protected boolean |
isReturnPathSet()
returns whether the e-mail has a return-path set. |
void |
putInlineImage(java.lang.String cid, SerializableDataSource att)
sets the images referenced froms the HTML content. |
void |
setAttachment(java.io.File file)
convenience method for setting a single file attachment. |
void |
setAttachment(SerializableDataSource att)
convenience method for setting a single file attachment. |
void |
setAttachments(java.util.Collection<SerializableDataSource> atts)
sets the attachments for the Email. |
void |
setAttachments(java.io.File[] files)
sets the attachments for the Email. |
void |
setAttachments(java.util.Map<java.lang.String,java.io.File> filesMap)
Sets the attachments from a map which maps file-names to Files. |
void |
setAttachments(java.util.Set<java.io.File> files)
sets the attachments for the Email. |
void |
setFrom(java.util.Collection<javax.mail.internet.InternetAddress> f)
sets the froms addresses of the Email. |
void |
setFrom(javax.mail.internet.InternetAddress f)
sets the froms of the Email. |
void |
setFrom(java.lang.String realName,
java.lang.String emailAddress)
sets the froms of the Email. |
void |
setFrom(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
sets the froms of the Email. |
void |
setHTMLContent(java.lang.String html)
sets the text/html content of the Email. |
void |
setInlineImages(java.util.Map<java.lang.String,java.io.File> images)
sets the images referenced froms the HTML content. |
void |
setRecipient(javax.mail.internet.InternetAddress r)
sets the recipients of the Email. |
void |
setRecipient(java.lang.String realName,
java.lang.String emailAddress)
sets the recipients of the Email. |
void |
setRecipient(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
sets the recipients of the Email. |
void |
setReplyTo(javax.mail.internet.InternetAddress r)
sets the reply-to of the Email. |
void |
setReplyTo(java.lang.String realName,
java.lang.String emailAddress)
sets the reply-to of the Email. |
void |
setReplyTo(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
sets the reply-to of the Email. |
void |
setReturnPath(java.lang.String emailAddress)
sets the return path of the Email. |
void |
setSubject(java.lang.String s)
sets the subject of the Email. |
void |
setTextContent(java.lang.String text)
sets the text/plain content of the Email. |
java.lang.String |
toString()
returns a string representation of the email giving the recipients and the subject. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Email()
Email.
public Email(EmailConfiguration conf)
conf - the configuration
public Email(EmailConfiguration conf,
org.jdom.Document d)
conf - the configurationd - the document
public Email(EmailConfiguration conf,
org.jdom.Element e)
conf - the configuratione - the element
public Email(EmailConfiguration conf,
java.lang.Object jaxbAble)
conf - the configurationjaxbAble - the JAXB enabled object| Method Detail |
|---|
public final void setSubject(java.lang.String s)
Email.
s - the subject
public final void setFrom(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
Email.
realName - the froms's real name, for example John DoeemailAddress - the froms's email address, for examle j.doe@something.orgencoding - the encoding to be used, for example ISO-8859-1 or
utf-8
java.io.UnsupportedEncodingException - if the requested encoding is not available
public final void setFrom(java.lang.String realName,
java.lang.String emailAddress)
throws java.io.UnsupportedEncodingException
Email.
realName - the froms's real name, for example John DoeemailAddress - the froms's email address, for examle j.doe@something.org
java.io.UnsupportedEncodingException - if the system is not able to provide utf-8 encodingpublic final void setFrom(javax.mail.internet.InternetAddress f)
Email.
f - the froms addresspublic final void setFrom(java.util.Collection<javax.mail.internet.InternetAddress> f)
Email.
f - the froms addresses
public final void setReplyTo(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
Email.
realName - the froms's real name, for example John DoeemailAddress - the froms's email address, for examle j.doe@something.orgencoding - the encoding to be used, for example ISO-8859-1 or
utf-8
java.io.UnsupportedEncodingException - if the requested encoding is not available
public final void setReplyTo(java.lang.String realName,
java.lang.String emailAddress)
throws java.io.UnsupportedEncodingException
Email.
realName - the froms's real name, for example John DoeemailAddress - the froms's email address, for examle j.doe@something.org
java.io.UnsupportedEncodingException - if the system is not able to provide utf-8 encodingpublic final void setReplyTo(javax.mail.internet.InternetAddress r)
Email.
r - the replay-to addresspublic final void setReturnPath(java.lang.String emailAddress)
Email.
emailAddress - the return path email addressprotected final java.lang.String getReturnPath()
protected final boolean isReturnPathSet()
true, if and only if the return-path is set.
Otherwise false.public final void setRecipient(javax.mail.internet.InternetAddress r)
Email.
r - the recipients
public final void setRecipient(java.lang.String realName,
java.lang.String emailAddress,
java.lang.String encoding)
throws java.io.UnsupportedEncodingException
Email.
realName - the recipients's real name, for example John DoeemailAddress - the recipients's email address, for example j.doe@something.orgencoding - the encoding to be used, for example ISO-8859-1 or
utf-8
java.io.UnsupportedEncodingException - if the requested encoding is not available
public final void setRecipient(java.lang.String realName,
java.lang.String emailAddress)
throws java.io.UnsupportedEncodingException
Email.
realName - the recipients's real name, for example John DoeemailAddress - the recipients's email address, for examle j.doe@something.org
java.io.UnsupportedEncodingException - if the system is not able to provide utf-8 encodingpublic final void setTextContent(java.lang.String text)
text/plain content of the Email.
text - the text contentpublic final void setHTMLContent(java.lang.String html)
text/html content of the Email.
html - the HTML contentpublic final void setInlineImages(java.util.Map<java.lang.String,java.io.File> images)
images - a Hashtable with the images: the key is the content-id
(cid) of the image, the value is a File pointing to
the image's locationpublic final void putInlineImage(java.lang.String cid, SerializableDataSource att)
cid - content-id (cid) of the imageatt - a SerializableDataSourcepublic final void clearInlineImages()
public final void setAttachment(java.io.File file)
file - the attachmentpublic final void setAttachment(SerializableDataSource att)
att - the SerializableDataSource to setpublic final void setAttachments(java.io.File[] files)
Email.
files - the files to be attachedpublic final void setAttachments(java.util.Set<java.io.File> files)
Email.
files - the files to be attachedpublic final void setAttachments(java.util.Collection<SerializableDataSource> atts)
Email.
atts - the attachments to setpublic final void setAttachments(java.util.Map<java.lang.String,java.io.File> filesMap)
Files.
filesMap - a map, mapping file names to Filespublic final void clearAttachments()
public final javax.mail.internet.MimeMessage asMimeMessage(javax.mail.Session session)
throws javax.mail.MessagingException
Email as a MimeMessage.
session - the mail session
Email as a MimeMessage
javax.mail.MessagingException - on errors creating the MimeMessagepublic final java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||