Class SimpleEmailServiceJavaMailSender

java.lang.Object
io.awspring.cloud.ses.SimpleEmailServiceMailSender
io.awspring.cloud.ses.SimpleEmailServiceJavaMailSender
All Implemented Interfaces:
DisposableBean, JavaMailSender, MailSender

public class SimpleEmailServiceJavaMailSender extends SimpleEmailServiceMailSender implements JavaMailSender
JavaMailSender implementation that allows to send MimeMessage using the Simple E-Mail Service. In contrast to SimpleEmailServiceMailSender this class also allows the use of attachment and other mime parts inside mail messages.
Since:
1.0
Author:
Agim Emruli, EddĂș MelĂ©ndez, Arun Patra
  • Constructor Details

    • SimpleEmailServiceJavaMailSender

      public SimpleEmailServiceJavaMailSender(software.amazon.awssdk.services.ses.SesClient sesClient)
    • SimpleEmailServiceJavaMailSender

      public SimpleEmailServiceJavaMailSender(software.amazon.awssdk.services.ses.SesClient sesClient, @Nullable String sourceArn)
  • Method Details

    • getJavaMailProperties

      protected Properties getJavaMailProperties()
      Allow Map access to the JavaMail properties of this sender, with the option to add or override specific entries.

      Useful for specifying entries directly, for example via "javaMailProperties[mail.from]".

      Returns:
      java mail properties
    • setJavaMailProperties

      public void setJavaMailProperties(Properties javaMailProperties)
      Set JavaMail properties for the Session.

      A new Session will be created with those properties.

      Non-default properties in this instance will override given JavaMail properties.

      Parameters:
      javaMailProperties - java mail props
    • getSession

      @Nullable protected jakarta.mail.Session getSession()
      Return the JavaMail Session, lazily initializing it if hasn't been specified explicitly.
      Returns:
      cached session or a new one from java mail properties
    • setSession

      public void setSession(jakarta.mail.Session session)
      Set the JavaMail Session, possibly pulled from JNDI.

      Default is a new Session without defaults, that is completely configured via this instance's properties.

      If using a pre-configured Session, non-default properties in this instance will override the settings in the Session.

      Parameters:
      session - JavaMail session
      See Also:
    • setDefaultEncoding

      public void setDefaultEncoding(String defaultEncoding)
      Set the default encoding to use for MimeMessages created by this instance.

      Such an encoding will be auto-detected by MimeMessageHelper.

      Parameters:
      defaultEncoding - default encoding for mime messages
    • setDefaultFileTypeMap

      public void setDefaultFileTypeMap(jakarta.activation.FileTypeMap defaultFileTypeMap)
      Set the default Java Activation FileTypeMap to use for MimeMessages created by this instance.

      A FileTypeMap specified here will be autodetected by MimeMessageHelper, avoiding the need to specify the FileTypeMap for each MimeMessageHelper instance.

      For example, you can specify a custom instance of Spring's ConfigurableMimeFileTypeMap here. If not explicitly specified, a default ConfigurableMimeFileTypeMap will be used, containing an extended set of MIME type mappings (as defined by the mime.types file contained in the Spring jar).

      Parameters:
      defaultFileTypeMap - Java Activation file type map
      See Also:
    • createMimeMessage

      public jakarta.mail.internet.MimeMessage createMimeMessage()
      Specified by:
      createMimeMessage in interface JavaMailSender
    • createMimeMessage

      public jakarta.mail.internet.MimeMessage createMimeMessage(InputStream contentStream) throws MailException
      Specified by:
      createMimeMessage in interface JavaMailSender
      Throws:
      MailException
    • send

      public void send(jakarta.mail.internet.MimeMessage mimeMessage) throws MailException
      Specified by:
      send in interface JavaMailSender
      Throws:
      MailException
    • send

      public void send(jakarta.mail.internet.MimeMessage... mimeMessages) throws MailException
      Specified by:
      send in interface JavaMailSender
      Throws:
      MailException
    • send

      public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException
      Specified by:
      send in interface JavaMailSender
      Throws:
      MailException
    • send

      public void send(MimeMessagePreparator... mimeMessagePreparators) throws MailException
      Specified by:
      send in interface JavaMailSender
      Throws:
      MailException