Class MailService


  • @Service
    public class MailService
    extends Object
    Service for sending emails.

    We use the Async annotation to send emails asynchronously.

    • Constructor Detail

      • MailService

        public MailService​(tech.jhipster.config.JHipsterProperties jHipsterProperties,
                           org.springframework.mail.javamail.JavaMailSender javaMailSender,
                           org.springframework.context.MessageSource messageSource,
                           org.thymeleaf.spring5.SpringTemplateEngine templateEngine)
    • Method Detail

      • sendEmail

        public void sendEmail​(String to,
                              String[] cc,
                              String subject,
                              String content,
                              boolean isMultipart,
                              boolean isHtml)
                       throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendEmailFromTemplate

        public void sendEmailFromTemplate​(org.thymeleaf.context.Context context,
                                          User user,
                                          String email,
                                          String[] cc,
                                          String templateName,
                                          String titleKey)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendEmailFromTemplate

        public void sendEmailFromTemplate​(org.thymeleaf.context.Context context,
                                          User user,
                                          String[] cc,
                                          String templateName,
                                          String titleKey)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendEmailFromTemplate

        public void sendEmailFromTemplate​(org.thymeleaf.context.Context context,
                                          User user,
                                          String[] cc,
                                          String templateName,
                                          String titleKey,
                                          String[] args)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendEmailFromTemplate

        public void sendEmailFromTemplate​(org.thymeleaf.context.Context context,
                                          User user,
                                          String email,
                                          String[] cc,
                                          String templateName,
                                          String titleKey,
                                          String[] args)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendEmailFromTemplate

        public void sendEmailFromTemplate​(User user,
                                          String templateName,
                                          String titleKey)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendActivationEmail

        public void sendActivationEmail​(User user)
                                 throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendCreationEmail

        public void sendCreationEmail​(User user)
                               throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException
      • sendPasswordResetMail

        public void sendPasswordResetMail​(User user)
                                   throws javax.mail.MessagingException
        Throws:
        javax.mail.MessagingException