Interface EmailService


@ProviderType public interface EmailService
A service interface for sending a generic template based Email Notification. The mailType is set to HTMLEmail by default if there are any attachments. Since we are using the template to determine the mailType, the template name has to be *.html. Here is an example to send an email with attachments: String attachment1 = "This text should be in the attache txt file." Map<String, DataSource> attachments = new HashMap<>(); attachments.put("attachment1.txt", new ByteArrayDataSource(attachment1, "text/plain")); ... ... List<String> participantList = emailService.sendEmail(htmlEmailTemplatePath, emailParams, attachments, key);
  • Method Summary

    Modifier and Type
    Method
    Description
    sendEmail(String templatePath, Map<String,String> emailParams, String... recipients)
    Construct an email based on a template and send it to one or more recipients.
    sendEmail(String templatePath, Map<String,String> emailParams, Map<String,DataSource> attachments, String... recipients)
    Construct an email with attachments based on a template and send it to one or more recipients.
    List<javax.mail.internet.InternetAddress>
    sendEmail(String templatePath, Map<String,String> emailParams, Map<String,DataSource> attachments, javax.mail.internet.InternetAddress... recipients)
    Construct an email with attachments based on a template and send it to one or more recipients.
    List<javax.mail.internet.InternetAddress>
    sendEmail(String templatePath, Map<String,String> emailParams, javax.mail.internet.InternetAddress... recipients)
    Construct an email based on a template and send it to one or more recipients.
  • Method Details

    • sendEmail

      List<javax.mail.internet.InternetAddress> sendEmail(String templatePath, Map<String,String> emailParams, javax.mail.internet.InternetAddress... recipients)
      Construct an email based on a template and send it to one or more recipients.
      Parameters:
      templatePath - Absolute path of the template used to send the email.
      emailParams - Replacement variable map to be injected in the template
      recipients - recipient email addresses
      Returns:
      failureList containing list recipient's InternetAddresses for which email sent failed
    • sendEmail

      List<String> sendEmail(String templatePath, Map<String,String> emailParams, String... recipients)
      Construct an email based on a template and send it to one or more recipients.
      Parameters:
      templatePath - Absolute path of the template used to send the email.
      emailParams - Replacement variable map to be injected in the template
      recipients - recipient email addresses. Invalid email addresses are skipped.
      Returns:
      failureList containing list recipient's String addresses for which email sent failed
    • sendEmail

      List<javax.mail.internet.InternetAddress> sendEmail(String templatePath, Map<String,String> emailParams, Map<String,DataSource> attachments, javax.mail.internet.InternetAddress... recipients)
      Construct an email with attachments based on a template and send it to one or more recipients.
      Parameters:
      templatePath - Absolute path of the template used to send the email.
      emailParams - Replacement variable map to be injected in the template
      attachments - attachments map with file name
      recipients - recipient email addresses
      Returns:
      failureList containing list recipient's String addresses for which email sent failed
    • sendEmail

      List<String> sendEmail(String templatePath, Map<String,String> emailParams, Map<String,DataSource> attachments, String... recipients)
      Construct an email with attachments based on a template and send it to one or more recipients.
      Parameters:
      templatePath - Absolute path of the template used to send the email.
      emailParams - Replacement variable map to be injected in the template
      attachments - attachments map with file name
      recipients - recipient email addresses
      Returns:
      failureList containing list recipient's String addresses for which email sent failed