|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.mail.Email
org.apache.commons.mail.MultiPartEmail
public class MultiPartEmail
A multipart email.
This class is used to send multi-part internet email like messages with attachments.
To create a multi-part email, call the default constructor and then you can call setMsg() to set the message and call the different attach() methods.
Field Summary |
---|
Fields inherited from class org.apache.commons.mail.Email |
---|
ATTACHMENTS, authenticator, bccList, bounceAddress, ccList, charset, content, CONTENT_TYPE, contentType, debug, EMAIL_BODY, EMAIL_SUBJECT, emailBody, FILE_SERVER, fromAddress, headers, hostName, ISO_8859_1, KOI8_R, MAIL_DEBUG, MAIL_HOST, MAIL_PORT, MAIL_SMTP_AUTH, MAIL_SMTP_FROM, MAIL_TRANSPORT_PROTOCOL, message, popBeforeSmtp, popHost, popPassword, popUsername, RECEIVER_EMAIL, RECEIVER_NAME, replyList, SENDER_EMAIL, SENDER_NAME, sentDate, SMTP, smtpPort, subject, TEXT_HTML, TEXT_PLAIN, toList, US_ASCII |
Constructor Summary | |
---|---|
MultiPartEmail()
|
Method Summary | |
---|---|
Email |
addPart(javax.mail.internet.MimeMultipart multipart)
Add a new part to the email. |
Email |
addPart(javax.mail.internet.MimeMultipart multipart,
int index)
Add a new part to the email. |
Email |
addPart(java.lang.String partContent,
java.lang.String partContentType)
Add a new part to the email. |
MultiPartEmail |
attach(javax.activation.DataSource ds,
java.lang.String name,
java.lang.String description)
Attach a file specified as a DataSource interface. |
MultiPartEmail |
attach(javax.activation.DataSource ds,
java.lang.String name,
java.lang.String description,
java.lang.String disposition)
Attach a file specified as a DataSource interface. |
MultiPartEmail |
attach(EmailAttachment attachment)
Attach an EmailAttachment. |
MultiPartEmail |
attach(java.net.URL url,
java.lang.String name,
java.lang.String description)
Attach a file located by its URL. |
MultiPartEmail |
attach(java.net.URL url,
java.lang.String name,
java.lang.String description,
java.lang.String disposition)
Attach a file located by its URL. |
void |
buildMimeMessage()
Builds the actual MimeMessage |
protected javax.mail.BodyPart |
createBodyPart()
Method that can be overridden if you don't want to create a MimeBodyPart. |
protected javax.mail.internet.MimeMultipart |
createMimeMultipart()
|
protected javax.mail.internet.MimeMultipart |
getContainer()
Gets the message container. |
protected javax.mail.BodyPart |
getPrimaryBodyPart()
Gets first body part of the message. |
java.lang.String |
getSubType()
Get the MIME subtype of the email. |
protected void |
init()
Initialize the multipart email. |
boolean |
isBoolHasAttachments()
|
protected boolean |
isInitialized()
|
void |
setBoolHasAttachments(boolean b)
|
protected void |
setInitialized(boolean b)
|
Email |
setMsg(java.lang.String msg)
Set the message of the email. |
void |
setSubType(java.lang.String aSubType)
Set the MIME subtype of the email. |
Methods inherited from class org.apache.commons.mail.Email |
---|
addBcc, addBcc, addCc, addCc, addHeader, addReplyTo, addReplyTo, addTo, addTo, getFromAddress, getHostName, getMailSession, getMimeMessage, getSentDate, getSmtpPort, getSubject, send, sendMimeMessage, setAuthentication, setAuthenticator, setBcc, setBounceAddress, setCc, setCharset, setContent, setContent, setDebug, setFrom, setFrom, setHeaders, setHostName, setMailSession, setPopBeforeSmtp, setSentDate, setSmtpPort, setSubject, setTo, toInternetAddressArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiPartEmail()
Method Detail |
---|
public void setSubType(java.lang.String aSubType)
aSubType
- MIME subtype of the emailpublic java.lang.String getSubType()
public Email addPart(java.lang.String partContent, java.lang.String partContentType) throws EmailException
partContent
- The content.partContentType
- The content type.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic Email addPart(javax.mail.internet.MimeMultipart multipart) throws EmailException
multipart
- The MimeMultipart.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic Email addPart(javax.mail.internet.MimeMultipart multipart, int index) throws EmailException
multipart
- The part to add.index
- The index to add at.
EmailException
- An error occured while adding the part.protected void init()
public Email setMsg(java.lang.String msg) throws EmailException
setMsg
in class Email
msg
- A String.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic void buildMimeMessage() throws EmailException
buildMimeMessage
in class Email
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic MultiPartEmail attach(EmailAttachment attachment) throws EmailException
attachment
- An EmailAttachment.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic MultiPartEmail attach(java.net.URL url, java.lang.String name, java.lang.String description) throws EmailException
url
- The URL of the file (may be any valid URL).name
- The name field for the attachment.description
- A description for the attachment.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic MultiPartEmail attach(java.net.URL url, java.lang.String name, java.lang.String description, java.lang.String disposition) throws EmailException
url
- The URL of the file (may be any valid URL).name
- The name field for the attachment.description
- A description for the attachment.disposition
- Either mixed or inline.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic MultiPartEmail attach(javax.activation.DataSource ds, java.lang.String name, java.lang.String description) throws EmailException
ds
- A DataSource interface for the file.name
- The name field for the attachment.description
- A description for the attachment.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic MultiPartEmail attach(javax.activation.DataSource ds, java.lang.String name, java.lang.String description, java.lang.String disposition) throws EmailException
ds
- A DataSource interface for the file.name
- The name field for the attachment.description
- A description for the attachment.disposition
- Either mixed or inline.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionsprotected javax.mail.BodyPart getPrimaryBodyPart() throws javax.mail.MessagingException
javax.mail.MessagingException
- An error occured while getting the primary body part.protected javax.mail.internet.MimeMultipart getContainer()
protected javax.mail.BodyPart createBodyPart()
protected javax.mail.internet.MimeMultipart createMimeMultipart()
public boolean isBoolHasAttachments()
public void setBoolHasAttachments(boolean b)
b
- boolHasAttachmentsprotected boolean isInitialized()
protected void setInitialized(boolean b)
b
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |