public class OneMimeMessageHelper extends Object
Provides utility functions to work with MimeMessage instances without having to handle messaging exceptions.
Constructor and Description |
---|
OneMimeMessageHelper(javax.mail.internet.MimeMessage message,
boolean isMultipart)
Create a new instance for a given mime message.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttachment(String attachmentFileName,
org.springframework.core.io.InputStreamSource inputStreamSource,
String contentType)
add attachment to the message.
|
void |
addHeaders(Map<String,String> headers)
Add additional message headers.
|
com.google.common.collect.ImmutableMap<String,String> |
getAllHeaders()
Get all message headers (including the standard ones).
|
List<String> |
getBcc()
Get the message 'Bcc' recipients.
|
String |
getBody()
Get the body.
|
List<String> |
getCc()
Get the message 'Cc' recipients.
|
List<String> |
getFrom()
Get the message 'from' address
|
javax.mail.internet.MimeMessage |
getMessage()
Returns the wrapped
MimeMessage . |
int |
getPriority()
Get the message priority.
|
List<String> |
getReplyTo()
Get the message 'ReplyTo' address.
|
String |
getSubject()
Get the message subject.
|
List<String> |
getTo()
Get the message 'To' recipients.
|
void |
setBcc(List<String> addresses)
Set the message 'Bcc' recipients.
|
void |
setBody(String content,
boolean isHtml)
Set the message body.
|
void |
setCc(List<String> addresses)
Set the message 'Cc' recipients.
|
void |
setFrom(String address)
Set the message 'from' address.
|
void |
setPriority(int priority)
Set the message priority.
|
void |
setReplyTo(String address)
Set the message 'ReplyTo' address.
|
void |
setSubject(String subject)
Set the message subject.
|
void |
setTo(List<String> addresses)
Set the message 'To' recipients.
|
public OneMimeMessageHelper(javax.mail.internet.MimeMessage message, boolean isMultipart)
Create a new instance for a given mime message.
message
- mime messageisMultipart
- multipart flagpublic javax.mail.internet.MimeMessage getMessage()
Returns the wrapped MimeMessage
.
MimeMessage
OneMimeMessageHelper(MimeMessage, boolean)
public void setSubject(String subject)
Set the message subject.
subject
- the message subjectpublic String getSubject()
Get the message subject.
public void setBody(String content, boolean isHtml)
Set the message body.
content
- the body contentisHtml
- true
if the body is HTML textpublic void setFrom(String address)
Set the message 'from' address.
address
- the message 'from' addresspublic List<String> getFrom()
Get the message 'from' address
public void setTo(List<String> addresses)
Set the message 'To' recipients.
addresses
- the message 'To' recipientspublic List<String> getTo()
Get the message 'To' recipients.
public void setReplyTo(String address)
Set the message 'ReplyTo' address.
address
- the message 'ReplyTo' addresspublic List<String> getReplyTo()
Get the message 'ReplyTo' address.
public void setCc(List<String> addresses)
Set the message 'Cc' recipients.
addresses
- the message 'Cc' recipientspublic List<String> getCc()
Get the message 'Cc' recipients.
public void setBcc(List<String> addresses)
Set the message 'Bcc' recipients.
addresses
- the message 'Bcc' recipientspublic List<String> getBcc()
Get the message 'Bcc' recipients.
public void setPriority(int priority)
Set the message priority.
priority
- the message priority (normally in the range 1-5)public int getPriority()
Get the message priority.
public String getBody()
Get the body.
public void addHeaders(Map<String,String> headers)
Add additional message headers.
headers
- the additional message headerspublic com.google.common.collect.ImmutableMap<String,String> getAllHeaders()
Get all message headers (including the standard ones).
public void addAttachment(String attachmentFileName, org.springframework.core.io.InputStreamSource inputStreamSource, String contentType)
add attachment to the message.
attachmentFileName
- name of the attached fileinputStreamSource
- file contentcontentType
- file content type.Copyright © 2010 - 2019 edorasware ag. All Rights Reserved.