public final class MailParser extends Object
MimeMessage and stores the individual parts such as context
text, attachments etc.| Constructor and Description |
|---|
MailParser(MimeMessage message)
Create a new
MailParser for the given MimeMessage. |
| Modifier and Type | Method and Description |
|---|---|
List<DataSource> |
getAttachments()
Get attachments.
|
List<InternetAddress> |
getBcc()
Get list of "bcc" recipients of the message.
|
List<InternetAddress> |
getCc()
Get list of "cc" recipients of the message.
|
InternetAddress |
getFrom()
Get "from" address of the message.
|
String |
getHeader(String name)
Get the first header value for the the header name.
|
String |
getHtml()
Get the html content if available.
|
InternetAddress |
getReplyTo()
Get "replyTo" address of the message.
|
String |
getSafeHtml()
Get sanitized safe html.
|
String |
getSubject()
Get the message subject line.
|
String |
getSummary()
Get the first line of the email as summary.
|
String |
getText()
Get plain text content if available.
|
List<InternetAddress> |
getTo()
Get list of "to" recipients of the message.
|
boolean |
hasAttachments()
Whether the message has attachments.
|
boolean |
isMultiPart()
Whether the message is multipart message.
|
MailParser |
parse()
Parse the message.
|
public MailParser(MimeMessage message)
MailParser for the given MimeMessage.message - the MimeMessage to parsepublic MailParser parse() throws MessagingException, IOException
MailParser instance itselfIOException - generally thrown by DataHandlerMessagingException - for failurespublic List<InternetAddress> getTo() throws MessagingException
InternetAddressMessagingException - if unable to get addressespublic List<InternetAddress> getCc() throws MessagingException
InternetAddressMessagingException - if unable to get addressespublic List<InternetAddress> getBcc() throws MessagingException
InternetAddressMessagingException - if unable to get addressespublic InternetAddress getFrom() throws MessagingException
InternetAddress or null if unable to read "from" fieldMessagingException - if unable to get addresspublic InternetAddress getReplyTo() throws MessagingException
InternetAddress or null unable to read "replyTo" field.MessagingException - if unable to get addresspublic String getSubject() throws MessagingException
MessagingException - for failurepublic String getText()
public String getHtml()
public String getSummary()
public String getSafeHtml()
public boolean isMultiPart()
public boolean hasAttachments()
public List<DataSource> getAttachments()
DataSourcepublic String getHeader(String name) throws MessagingException
name - header nameMessagingException - for failures