Class DefaultMailService

java.lang.Object
net.solarnetwork.central.mail.support.DefaultMailService
All Implemented Interfaces:
MailService

public class DefaultMailService extends Object implements MailService
Default implementation of MailService that uses Spring's mail classes for sending mail.
  • Constructor Details

    • DefaultMailService

      public DefaultMailService(org.springframework.mail.MailSender mailSender)
      Constructor.
      Parameters:
      mailSender - the MailSender to use
  • Method Details

    • sendMail

      public void sendMail(MailAddress address, MessageDataSource messageDataSource)
      Description copied from interface: MailService
      Send a template-based mail message.
      Specified by:
      sendMail in interface MailService
      Parameters:
      address - where to send the mail to
      messageDataSource - 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, or 0 to 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