public class MimeMessageParser
extends java.lang.Object
Constructor and Description |
---|
MimeMessageParser(MimeMessage message)
Constructs an instance with the MimeMessage to be extracted.
|
Modifier and Type | Method and Description |
---|---|
javax.activation.DataSource |
findAttachmentByCid(java.lang.String cid)
Find an attachment using its content-id.
|
javax.activation.DataSource |
findAttachmentByName(java.lang.String name)
Find an attachment using its name.
|
java.util.List<javax.activation.DataSource> |
getAttachmentList() |
java.util.List<javax.mail.Address> |
getBcc() |
java.util.List<javax.mail.Address> |
getCc() |
java.util.Collection<java.lang.String> |
getContentIds()
Returns a collection of all content-ids in the parsed message.
|
java.lang.String |
getFrom() |
java.lang.String |
getHtmlContent() |
MimeMessage |
getMimeMessage() |
java.lang.String |
getPlainContent() |
java.lang.String |
getReplyTo() |
java.lang.String |
getSubject() |
java.util.List<javax.mail.Address> |
getTo() |
boolean |
hasAttachments() |
boolean |
hasHtmlContent() |
boolean |
hasPlainContent() |
boolean |
isMultipart() |
MimeMessageParser |
parse()
Does the actual extraction.
|
public MimeMessageParser(MimeMessage message)
message
- the message to parsepublic MimeMessageParser parse() throws java.lang.Exception
java.lang.Exception
- parsing the mime message failedpublic java.util.List<javax.mail.Address> getTo() throws java.lang.Exception
java.lang.Exception
- determining the recipients failedpublic java.util.List<javax.mail.Address> getCc() throws java.lang.Exception
java.lang.Exception
- determining the recipients failedpublic java.util.List<javax.mail.Address> getBcc() throws java.lang.Exception
java.lang.Exception
- determining the recipients failedpublic java.lang.String getFrom() throws java.lang.Exception
java.lang.Exception
- parsing the mime message failedpublic java.lang.String getReplyTo() throws java.lang.Exception
java.lang.Exception
- parsing the mime message failedpublic java.lang.String getSubject() throws java.lang.Exception
java.lang.Exception
- parsing the mime message failedpublic MimeMessage getMimeMessage()
public boolean isMultipart()
public java.lang.String getPlainContent()
public java.util.List<javax.activation.DataSource> getAttachmentList()
public java.util.Collection<java.lang.String> getContentIds()
The content-ids are stripped of any angle brackets, i.e. "part1" instead of "<part1>".
public java.lang.String getHtmlContent()
public boolean hasPlainContent()
public boolean hasHtmlContent()
public boolean hasAttachments()
public javax.activation.DataSource findAttachmentByName(java.lang.String name)
name
- the name of the attachmentpublic javax.activation.DataSource findAttachmentByCid(java.lang.String cid)
The content-id must be stripped of any angle brackets, i.e. "part1" instead of "<part1>".
cid
- the content-id of the attachment"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"