Class DefaultMailService
java.lang.Object
net.solarnetwork.central.mail.support.DefaultMailService
- All Implemented Interfaces:
MailService
Default implementation of
MailService that uses Spring's mail classes
for sending mail.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMailService(org.springframework.mail.MailSender mailSender) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintGet the hard-wrap character column size setting.org.springframework.mail.SimpleMailMessageGet the template to use as a starting point for all messages.booleanisHtml()Get the HTML content flag.voidsendMail(MailAddress address, MessageDataSource messageDataSource) Send a template-based mail message.voidsetHardWrapColumnIndex(int hardWrapColumnIndex) Set a character index to hard-wrap message text at.voidsetHtml(boolean html) Set the HTML content flag.voidsetTemplateMessage(org.springframework.mail.SimpleMailMessage templateMessage) Set the template to use as a starting point for all messages.
-
Constructor Details
-
DefaultMailService
public DefaultMailService(org.springframework.mail.MailSender mailSender) Constructor.- Parameters:
mailSender- theMailSenderto use
-
-
Method Details
-
sendMail
Description copied from interface:MailServiceSend a template-based mail message.- Specified by:
sendMailin interfaceMailService- Parameters:
address- where to send the mail tomessageDataSource- the message data source
-
getTemplateMessage
public org.springframework.mail.SimpleMailMessage getTemplateMessage()Get the template to use as a starting point for all messages.- Returns:
- the template message, or null
-
setTemplateMessage
public void setTemplateMessage(org.springframework.mail.SimpleMailMessage templateMessage) Set the template to use as a starting point for all messages.This can be used to configure a default "from" address, for example.
- Parameters:
templateMessage- the template to use
-
getHardWrapColumnIndex
public int getHardWrapColumnIndex()Get the hard-wrap character column size setting.- Returns:
- The hard-wrap column.
- Since:
- 1.1
-
setHardWrapColumnIndex
public void setHardWrapColumnIndex(int hardWrapColumnIndex) Set a character index to hard-wrap message text at. Hard-wrapping is disabled by setting this to zero.- Parameters:
hardWrapColumnIndex- The column index to hard-wrap message text at, or0to disable hard wrapping.- Since:
- 1.1
-
isHtml
public boolean isHtml()Get the HTML content flag.- Returns:
- true if the message body is HTML, false for plain text; defaults to false
- Since:
- 1.3
-
setHtml
public void setHtml(boolean html) Set the HTML content flag.- Parameters:
html- true if the message body is HTML, false for plain text- Since:
- 1.3
-