public class EmailInfo
extends java.lang.Object
implements java.io.Serializable
EmailService
,
Serialized FormModifier and Type | Field and Description |
---|---|
static java.lang.String |
HTML_CONTENT_TYPE |
static java.lang.String |
TEXT_CONTENT_TYPE |
Constructor and Description |
---|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String body)
Constructor.
|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String body,
java.lang.String bodyContentType)
Constructor.
|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String from,
java.lang.String body,
EmailAttachment... attachments)
Constructor.
|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String from,
java.lang.String templatePath,
java.util.Map<java.lang.String,java.io.Serializable> templateParameters,
EmailAttachment... attachments)
Constructor.
|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String from,
java.lang.String body,
java.lang.String bodyContentType,
EmailAttachment... attachments)
Constructor.
|
EmailInfo(java.lang.String addresses,
java.lang.String caption,
java.lang.String from,
java.lang.String bodyContentType,
java.lang.String templatePath,
java.util.Map<java.lang.String,java.io.Serializable> templateParameters,
EmailAttachment... attachments)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(java.lang.String name,
java.lang.String value) |
java.lang.String |
getAddresses() |
EmailAttachment[] |
getAttachments() |
java.lang.String |
getBody() |
java.lang.String |
getBodyContentType() |
java.lang.String |
getCaption() |
java.lang.String |
getFrom() |
java.util.List<EmailHeader> |
getHeaders() |
java.util.Map<java.lang.String,java.io.Serializable> |
getTemplateParameters() |
java.lang.String |
getTemplatePath() |
void |
setAddresses(java.lang.String addresses) |
void |
setAttachments(EmailAttachment[] attachments) |
void |
setBody(java.lang.String body) |
void |
setBodyContentType(java.lang.String bodyContentType) |
void |
setCaption(java.lang.String caption) |
void |
setFrom(java.lang.String from) |
void |
setHeaders(java.util.List<EmailHeader> headers) |
void |
setTemplateParameters(java.util.Map<java.lang.String,java.io.Serializable> templateParameters) |
void |
setTemplatePath(java.lang.String templatePath) |
public static final java.lang.String HTML_CONTENT_TYPE
public static final java.lang.String TEXT_CONTENT_TYPE
public EmailInfo(java.lang.String addresses, java.lang.String caption, @Nullable java.lang.String from, java.lang.String templatePath, java.util.Map<java.lang.String,java.io.Serializable> templateParameters, EmailAttachment... attachments)
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
"do-not-reply@company.com",
"com/company/sample/email_templates/news.txt",
Collections.singletonMap("some_var", some_value)
);
If you want to set content body type you can use
EmailInfo(String, String, String, String, String, Map, EmailAttachment...)
instead or use setBodyContentType()
method.addresses
- comma or semicolon separated list of addressescaption
- email subjectfrom
- "from" address. If null, a default provided by cuba.email.fromAddress
app property is used.templatePath
- path to a Freemarker template which is used to create the message body. The template
is loaded through Resources
in the core module.templateParameters
- map of parameters to be passed to the templateattachments
- email attachments. Omit this parameter if there are no attachments.public EmailInfo(java.lang.String addresses, java.lang.String caption, @Nullable java.lang.String from, java.lang.String bodyContentType, java.lang.String templatePath, java.util.Map<java.lang.String,java.io.Serializable> templateParameters, EmailAttachment... attachments)
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
"do-not-reply@company.com",
EmailInfo.HTML_CONTENT_TYPE,
"com/company/sample/email_templates/news.txt",
Collections.singletonMap("some_var", some_value)
);
addresses
- comma or semicolon separated list of addressescaption
- email subjectfrom
- "from" address. If null, a default provided by cuba.email.fromAddress
app property is used.bodyContentType
- email body like "text/plain; charset=UTF-8" or "text/html; charset=UTF-8", etctemplatePath
- path to a Freemarker template which is used to create the message body. The template
is loaded through Resources
in the core module.templateParameters
- map of parameters to be passed to the templateattachments
- email attachments. Omit this parameter if there are no attachments.public EmailInfo(java.lang.String addresses, java.lang.String caption, @Nullable java.lang.String from, java.lang.String body, EmailAttachment... attachments)
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
null,
"Some content"
);
If you want to set content body type you can use
EmailInfo(String, String, String, String, String, EmailAttachment...)
instead or use setBodyContentType()
method.addresses
- comma or semicolon separated list of addressescaption
- email subjectfrom
- "from" address. If null, a default provided by cuba.email.fromAddress
app property is used.body
- email bodyattachments
- email attachments. Omit this parameter if there are no attachments.public EmailInfo(java.lang.String addresses, java.lang.String caption, @Nullable java.lang.String from, java.lang.String body, java.lang.String bodyContentType, EmailAttachment... attachments)
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
null,
"Some content",
EmailInfo.TEXT_CONTENT_TYPE
);
addresses
- comma or semicolon separated list of addressescaption
- email subjectfrom
- "from" address. If null, a default provided by cuba.email.fromAddress
app property is used.body
- email bodybodyContentType
- email body like "text/plain; charset=UTF-8" or "text/html; charset=UTF-8", etcattachments
- email attachments. Omit this parameter if there are no attachments.public EmailInfo(java.lang.String addresses, java.lang.String caption, java.lang.String body)
cuba.email.fromAddress
app property.
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
"Some content"
);
If you want to set content body type you can use EmailInfo(String, String, String, String)
instead or
use setBodyContentType()
method.addresses
- comma or semicolon separated list of addressescaption
- email subjectbody
- email bodypublic EmailInfo(java.lang.String addresses, java.lang.String caption, java.lang.String body, java.lang.String bodyContentType)
cuba.email.fromAddress
app property.
EmailInfo emailInfo = new EmailInfo(
"john.doe@company.com,jane.roe@company.com",
"Company news",
"Some content",
EmailInfo.TEXT_CONTENT_TYPE"
);
addresses
- comma or semicolon separated list of addressescaption
- email subjectbody
- email bodybodyContentType
- email body like "text/plain; charset=UTF-8" or "text/html; charset=UTF-8", etcpublic java.lang.String getAddresses()
public void setAddresses(java.lang.String addresses)
public java.lang.String getCaption()
public void setCaption(java.lang.String caption)
public java.lang.String getTemplatePath()
public void setTemplatePath(java.lang.String templatePath)
public java.lang.String getBody()
public void setBody(java.lang.String body)
public EmailAttachment[] getAttachments()
public void setAttachments(EmailAttachment[] attachments)
public java.util.Map<java.lang.String,java.io.Serializable> getTemplateParameters()
public void setTemplateParameters(java.util.Map<java.lang.String,java.io.Serializable> templateParameters)
public java.lang.String getFrom()
public void setFrom(java.lang.String from)
public java.util.List<EmailHeader> getHeaders()
public void setHeaders(java.util.List<EmailHeader> headers)
public void addHeader(java.lang.String name, java.lang.String value)
public java.lang.String getBodyContentType()
public void setBodyContentType(java.lang.String bodyContentType)