public abstract class EmailSender extends Object
Constructor and Description |
---|
EmailSender() |
EmailSender(EmailSettings emailSettings) |
Modifier and Type | Method and Description |
---|---|
protected void |
doSend() |
String |
getCustomKey() |
String |
getFrom()
The email from address
|
String |
getHtml()
The HTML for the email body
|
String |
getReplyTo()
The reply to address (optional)
|
String |
getSubject()
The email subject
|
String |
getText()
Plain text version of the email body
|
List<String> |
getTos()
A list of valid email addresses that we are sending to
|
String |
getType() |
protected void |
init(EmailSettings emailSettings) |
boolean |
isShouldLog() |
protected void |
logEmail() |
static EmailSender |
newSender()
Create a new instance of the default implementation for this application.
|
boolean |
send()
Send the email.
|
EmailSender |
setCustomKey(String customKey) |
EmailSender |
setFrom(String from) |
EmailSender |
setHtml(String html) |
EmailSender |
setReplyTo(String replyTo) |
EmailSender |
setShouldLog(boolean shouldLog) |
EmailSender |
setSubject(String subject) |
EmailSender |
setText(String text) |
EmailSender |
setTo(String... tos) |
EmailSender |
setTos(List<String> tos) |
EmailSender |
setType(String type) |
void |
validate()
Validate the email settings to make sure that a user, host, password, etc, have been set correctly.
|
public EmailSender()
public EmailSender(EmailSettings emailSettings)
public static EmailSender newSender()
protected void init(EmailSettings emailSettings)
public boolean send()
protected void logEmail()
public void validate() throws ValidationException
ValidationException
protected void doSend() throws javax.mail.MessagingException, EmailSendException, ValidationException
javax.mail.MessagingException
EmailSendException
ValidationException
public EmailSender setTos(List<String> tos)
public EmailSender setTo(String... tos)
public EmailSender setFrom(String from)
public EmailSender setHtml(String html)
public EmailSender setText(String text)
public String getReplyTo()
public EmailSender setReplyTo(String replyTo)
public String getSubject()
public EmailSender setSubject(String subject)
public String getCustomKey()
public EmailSender setCustomKey(String customKey)
public boolean isShouldLog()
public EmailSender setShouldLog(boolean shouldLog)
public EmailSender setType(String type)
Copyright © 2016. All rights reserved.