|
||||||||||
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 |
---|
Constructor Summary | |
---|---|
MultiPartEmail()
|
Method Summary | |
---|---|
Email |
addPart(MimeMultipart multipart)
Add a new part to the email. |
Email |
addPart(MimeMultipart multipart,
int index)
Add a new part to the email. |
Email |
addPart(String partContent,
String partContentType)
Add a new part to the email. |
MultiPartEmail |
attach(DataSource ds,
String name,
String description)
Attach a file specified as a DataSource interface. |
MultiPartEmail |
attach(DataSource ds,
String name,
String description,
String disposition)
Attach a file specified as a DataSource interface. |
MultiPartEmail |
attach(EmailAttachment attachment)
Attach an EmailAttachment. |
MultiPartEmail |
attach(File file)
Attach a file. |
MultiPartEmail |
attach(URL url,
String name,
String description)
Attach a file located by its URL. |
MultiPartEmail |
attach(URL url,
String name,
String description,
String disposition)
Attach a file located by its URL. |
void |
buildMimeMessage()
Does the work of actually building the MimeMessage. |
protected BodyPart |
createBodyPart()
Creates a body part object. |
protected MimeMultipart |
createMimeMultipart()
Creates a mime multipart object. |
protected MimeMultipart |
getContainer()
Gets the message container. |
protected BodyPart |
getPrimaryBodyPart()
Gets first body part of the message. |
String |
getSubType()
Get the MIME subtype of the email. |
protected void |
init()
Initialize the multipart email. |
boolean |
isBoolHasAttachments()
Checks whether there are attachments. |
protected boolean |
isInitialized()
Checks if this object is initialized. |
void |
setBoolHasAttachments(boolean b)
Sets whether there are attachments. |
protected void |
setInitialized(boolean b)
Sets the initialized status of this object. |
Email |
setMsg(String msg)
Set the message of the email. |
void |
setSubType(String aSubType)
Set the MIME subtype of the email. |
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(String aSubType)
aSubType
- MIME subtype of the emailpublic String getSubType()
public Email addPart(String partContent, String partContentType) throws EmailException
partContent
- The content.partContentType
- The content type.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic Email addPart(MimeMultipart multipart) throws EmailException
multipart
- The MimeMultipart.
EmailException
- see javax.mail.internet.MimeBodyPart
for definitionspublic Email addPart(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(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
- if there was an error.public MultiPartEmail attach(File file) throws EmailException
file
- A file attachment
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(URL url, String name, 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(URL url, String name, String description, 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(DataSource ds, String name, 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(DataSource ds, String name, String description, 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 BodyPart getPrimaryBodyPart() throws MessagingException
MessagingException
- An error occurred while getting the primary body part.protected MimeMultipart getContainer()
protected BodyPart createBodyPart()
protected MimeMultipart createMimeMultipart()
public boolean isBoolHasAttachments()
public void setBoolHasAttachments(boolean b)
b
- the attachments flagprotected boolean isInitialized()
protected void setInitialized(boolean b)
b
- the initialized status flag
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |