Class MailSenderServiceImpl

java.lang.Object
best.skn.mail.services.impls.MailSenderServiceImpl
All Implemented Interfaces:
MailSenderService

@Service public class MailSenderServiceImpl extends Object implements MailSenderService
Mail Sender Service Implementation Class
Since:
2024-05-29
Version:
2.0.1
Author:
SKN Shukhan
Use Case:
Spring Boot Reactive
Dedicated To:
Logno, Atoshi and My Parents
  • Field Details

    • mailSender

      @Autowired private org.springframework.mail.javamail.JavaMailSender mailSender
      Private Java Mail Sender object
      Since:
      v2.0.0
    • templateEngine

      @Autowired private org.thymeleaf.TemplateEngine templateEngine
      private Thymeleaf Template Engine object
      Since:
      v2.0.0
  • Constructor Details

    • MailSenderServiceImpl

      public MailSenderServiceImpl()
  • Method Details

    • sendMail

      public reactor.core.publisher.Mono<String> sendMail(MailSenderRequestInfo info) throws jakarta.mail.MessagingException
      Description copied from interface: MailSenderService
      Method to send basic mail
      Specified by:
      sendMail in interface MailSenderService
      Parameters:
      info - MailSenderRequestInfo object that contains all the information regarding sending mail
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - an exception is thrown if an error occurs while sending mail
    • sendMailWithAttachment

      public reactor.core.publisher.Mono<String> sendMailWithAttachment(MailSenderRequestInfo info, MailSenderInputStream stream) throws jakarta.mail.MessagingException, IOException
      Description copied from interface: MailSenderService
      Method to send basic mail with attachment
      Specified by:
      sendMailWithAttachment in interface MailSenderService
      Parameters:
      info - MailSenderRequestInfo object that contains all the information regarding sending mail
      stream - MailSenderInputStream object that contains all the information regarding input stream
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - an exception is thrown if an error occurs while sending mail
      IOException - an exception is thrown if an error occurs in file attachment
    • sendMailWithHtmlTemplate

      public reactor.core.publisher.Mono<String> sendMailWithHtmlTemplate(MailSenderRequestInfo info, MailSenderHtmlTemplate template) throws jakarta.mail.MessagingException
      Description copied from interface: MailSenderService
      Method to send mail with HTML template
      Specified by:
      sendMailWithHtmlTemplate in interface MailSenderService
      Parameters:
      info - MailSenderRequestInfo object that contains all the information regarding sending mail
      template - MailSenderHtmlTemplate object that contains all the information regarding thymeleaf
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - an exception is thrown if an error occurs while sending mail
    • sendMailWithHtmlTemplateAndAttachment

      public reactor.core.publisher.Mono<String> sendMailWithHtmlTemplateAndAttachment(MailSenderRequestInfo info, MailSenderHtmlTemplate template, MailSenderInputStream stream) throws jakarta.mail.MessagingException, IOException
      Description copied from interface: MailSenderService
      Method to send mail with HTML template and attachment
      Specified by:
      sendMailWithHtmlTemplateAndAttachment in interface MailSenderService
      Parameters:
      info - MailSenderRequestInfo object that contains all the information regarding sending mail
      template - MailSenderHtmlTemplate object that contains all the information regarding thymeleaf
      stream - MailSenderInputStream object that contains all the information regarding input stream
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - an exception is thrown if an error occurs while sending mail
      IOException - an exception is thrown if an error occurs in file attachment