Class EmailService

  • All Implemented Interfaces:
    org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

    public class EmailService
    extends ServiceConfig
    • Constructor Detail

      • EmailService

        public EmailService​(org.springframework.mail.javamail.JavaMailSender mailSender,
                            XMLEmailBuilder emailBuilder,
                            BaseConfigProperties baseConfigProperties)
        Autowired constructor
        Parameters:
        mailSender - Email sender
        emailBuilder - Email builder
        baseConfigProperties - Base configuration properties
    • Method Detail

      • sendEmail

        @Async("contextlessTaskExecutor")
        public void sendEmail​(ParsedEmail email)
      • generateMultipartMessage

        protected javax.mail.Multipart generateMultipartMessage​(ParsedEmail email)
                                                         throws javax.mail.MessagingException,
                                                                IOException
        Generate email message parts
        Returns:
        Multipart
        Throws:
        javax.mail.MessagingException - Error generating message
        IOException - Error retrieving file
      • generateMultipartAttachments

        protected void generateMultipartAttachments​(ParsedEmail email,
                                                    javax.mail.Multipart multipart)
                                             throws javax.mail.MessagingException,
                                                    IOException
        Append attachments
        Parameters:
        multipart - Attachments
        Throws:
        javax.mail.MessagingException - Message exception
        IOException - IO exception
      • setRecipients

        protected void setRecipients​(ParsedEmail email,
                                     javax.mail.internet.MimeMessage message)
                              throws javax.mail.MessagingException
        Set email recipients
        Parameters:
        email - Email
        message - Mime message
        Throws:
        javax.mail.MessagingException - Error generating email