Interface MailSenderInterface

All Known Implementing Classes:
MailSenderService

@Component public interface MailSenderInterface
Mail Sender Service Interface
Since:
2024-03-07
Version:
1.2.2
Author:
SKN
Use Case:
Spring Boot Reactive
Dedicated To:
Trina, Logno and Atoshi
  • Method Details

    • sendMail

      reactor.core.publisher.Mono<String> sendMail(String from, String to, String subject, String body) throws jakarta.mail.MessagingException
      Method to send basic mail
      Parameters:
      from - a String which must be a valid email address from whom the mail will be sent
      to - a String which must be a valid email address to whom the mail will be sent
      subject - a String containing the subject of the mail
      body - a String containing the main body of the mail
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - a messaging exception if the mail is not sent successfully
      Since:
      v1.0.0
    • sendMailWithAttachment

      reactor.core.publisher.Mono<String> sendMailWithAttachment(String from, String to, String subject, String body, String filePath) throws jakarta.mail.MessagingException
      Method to send basic mail with attachment
      Parameters:
      from - a String which must be a valid email address from whom the mail will be sent
      to - a String which must be a valid email address to whom the mail will be sent
      subject - a String containing the subject of the mail
      body - a String containing the main body of the mail
      filePath - a String containing the file path to the attachment
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - a messaging exception if the mail is not sent successfully
      Since:
      v1.0.0
    • sendMailWithHtmlTemplate

      reactor.core.publisher.Mono<String> sendMailWithHtmlTemplate(String from, String to, String subject, String templateName, org.thymeleaf.context.Context context) throws jakarta.mail.MessagingException
      Method to send mail with HTML template
      Parameters:
      from - a String which must be a valid email address from whom the mail will be sent
      to - a String which must be a valid email address to whom the mail will be sent
      subject - a String containing the subject of the mail
      templateName - a String containing the template name for the HTML template
      context - a Thymeleaf Context for the HTML template
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - a messaging exception if the mail is not sent successfully
      Since:
      v1.0.0
    • sendMailWithHtmlTemplateAndAttachment

      reactor.core.publisher.Mono<String> sendMailWithHtmlTemplateAndAttachment(String from, String to, String subject, String templateName, org.thymeleaf.context.Context context, String filePath) throws jakarta.mail.MessagingException
      Method to send mail with HTML template and attachment
      Parameters:
      from - a String which must be a valid email address from whom the mail will be sent
      to - a String which must be a valid email address to whom the mail will be sent
      subject - a String containing the subject of the mail
      templateName - a String containing the template name for the HTML template
      context - a Thymeleaf Context for the HTML template
      filePath - a String containing the file path to the attachment
      Returns:
      a Mono of String as a response
      Throws:
      jakarta.mail.MessagingException - a messaging exception if the mail is not sent successfully
      Since:
      v1.0.0