public class MimeMessageParser extends Object
| Constructor and Description |
|---|
MimeMessageParser(MimeMessage message)
Constructs an instance with the MimeMessage to be extracted.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public MimeMessageParser(MimeMessage message)
message - the message to parsepublic 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 MimePartMessagingException - parsing the MimeMessage failedIOException - parsing the MimeMessage failedprotected DataSource createDataSource(Multipart parent, MimePart part) throws MessagingException, IOException
parent - the parent multi-partpart - the current part to be processedMessagingException - creating the DataSource failedIOException - 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 attachmentprotected String getDataSourceName(Part part, DataSource dataSource) throws MessagingException, UnsupportedEncodingException
part - the mail partdataSource - the data sourcenull if no name can be determinedMessagingException - accessing the part failedUnsupportedEncodingException - decoding the text failedCopyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.