Class MailPublisher


  • @Component
    public class MailPublisher
    extends Object
    Author:
    Daniel Koch
    • Constructor Detail

      • MailPublisher

        public MailPublisher()
    • Method Detail

      • sendMail

        public void sendMail​(String from,
                             String replyTo,
                             String[] to,
                             String[] cc,
                             String[] bcc,
                             String subject,
                             String msg)
                      throws Exception
        Sends a SimpleMailMessage.
        Parameters:
        from - The mail sender address.
        replyTo - The reply to address.
        to - A list of mail recipient addresses.
        cc - A list of carbon copy mail recipient addresses.
        bcc - A list of blind carbon copy mail recipient addresses.
        subject - The mail subject.
        msg - The mail message text.
        Throws:
        Exception
      • sendMimeMail

        public void sendMimeMail​(String from,
                                 String replyTo,
                                 String[] to,
                                 String[] cc,
                                 String[] bcc,
                                 String subject,
                                 String msg,
                                 Boolean html,
                                 String attachmentFilename,
                                 File attachmentFile)
                          throws javax.mail.MessagingException,
                                 org.springframework.mail.MailException
        Sends a MimeMessage.
        Parameters:
        from - The mail sender address.
        replyTo - The reply to address.
        to - A list of mail recipient addresses.
        cc - A list of carbon copy mail recipient addresses.
        bcc - A list of blind carbon copy mail recipient addresses.
        subject - The mail subject.
        msg - The mail message text.
        html - Whether to apply content type "text/html" or the default content type ("text/plain").
        attachmentFilename - The attachment file name.
        attachmentFile - The file resource to be applied to the mail.
        Throws:
        javax.mail.MessagingException
        org.springframework.mail.MailException
      • sendMail

        public void sendMail​(org.springframework.mail.SimpleMailMessage mailMessage)
                      throws org.springframework.mail.MailException
        Parameters:
        mailMessage -
        Throws:
        org.springframework.mail.MailException
      • sendMail

        public void sendMail​(javax.mail.internet.MimeMessage mimeMessage)
                      throws org.springframework.mail.MailException,
                             javax.mail.MessagingException
        Parameters:
        mimeMessage -
        Throws:
        javax.mail.MessagingException
        org.springframework.mail.MailException
      • getMailSender

        public org.springframework.mail.javamail.JavaMailSender getMailSender()
        Returns:
        the mailSender
      • setMailSender

        public void setMailSender​(org.springframework.mail.javamail.JavaMailSender mailSender)
        Parameters:
        mailSender - the mailSender to set
      • getDefaultMailSender

        public String getDefaultMailSender()
        Returns:
        the defaultMailSender
      • setDefaultMailSender

        public void setDefaultMailSender​(String defaultMailSender)
        Parameters:
        defaultMailSender - the defaultMailSender to set