|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.mail.util.MimeMessageParser
public class MimeMessageParser
Parses a MimeMessage and stores the individual parts such a plain text, HTML text and attachments.
Constructor Summary | |
---|---|
MimeMessageParser(MimeMessage message)
Constructs an instance with the MimeMessage to be extracted. |
Method Summary | |
---|---|
protected DataSource |
createDataSource(Multipart parent,
MimePart part)
Parses the MimePart to create a DataSource. |
DataSource |
findAttachmentByName(String name)
Find an attachment using its name. |
List<DataSource> |
getAttachmentList()
|
List<Address> |
getBcc()
|
List<Address> |
getCc()
|
protected String |
getDataSourceName(Part part,
DataSource dataSource)
Determines the name of the data source if it is not already set. |
String |
getFrom()
|
String |
getHtmlContent()
|
MimeMessage |
getMimeMessage()
|
String |
getPlainContent()
|
String |
getReplyTo()
|
String |
getSubject()
|
List<Address> |
getTo()
|
boolean |
hasAttachments()
|
boolean |
hasHtmlContent()
|
boolean |
hasPlainContent()
|
boolean |
isMultipart()
|
MimeMessageParser |
parse()
Does the actual extraction. |
protected void |
parse(Multipart parent,
MimePart part)
Extracts the content of a MimeMessage recursively. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MimeMessageParser(MimeMessage message)
message
- the message to parseMethod Detail |
---|
public MimeMessageParser parse() throws Exception
Exception
- parsing the mime message failedpublic List<Address> getTo() throws Exception
Exception
- determining the recipients failedpublic List<Address> getCc() throws Exception
Exception
- determining the recipients failedpublic List<Address> getBcc() throws Exception
Exception
- determining the recipients failedpublic String getFrom() throws Exception
Exception
- parsing the mime message failedpublic String getReplyTo() throws Exception
Exception
- parsing the mime message failedpublic String getSubject() throws Exception
Exception
- parsing the mime message failedprotected void parse(Multipart parent, MimePart part) throws MessagingException, IOException
parent
- the parent multi-partpart
- the current MimePart
MessagingException
- parsing the MimeMessage failed
IOException
- parsing the MimeMessage failedprotected DataSource createDataSource(Multipart parent, MimePart part) throws MessagingException, IOException
parent
- the parent multi-partpart
- the current part to be processed
MessagingException
- creating the DataSource failed
IOException
- creating the DataSource failedpublic MimeMessage getMimeMessage()
public boolean isMultipart()
public String getPlainContent()
public List<DataSource> getAttachmentList()
public String getHtmlContent()
public boolean hasPlainContent()
public boolean hasHtmlContent()
public boolean hasAttachments()
public DataSource findAttachmentByName(String name)
name
- the name of the attachment
protected String getDataSourceName(Part part, DataSource dataSource) throws MessagingException, UnsupportedEncodingException
part
- the mail partdataSource
- the data source
null
if no name can be determined
MessagingException
- accessing the part failed
UnsupportedEncodingException
- decoding the text failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |