Class MailSendingApplication

java.lang.Object
io.awspring.cloud.samples.ses.MailSendingApplication

@SpringBootApplication public class MailSendingApplication extends Object
A sample application to demonstrate sending simple emails and emails with attachments.

To run this sample application, you need to do either of the following.

  • If you wish to send emails to a real email ID, you need to verify identities as mentioned in the Amazon Simple Email Service docs. After you do that, simply update this sample app with email IDs that you have verified with AWS.
  • If you wish to just test out email sending capability in a test environment, you can do so by running localstack. Just issue the following command from the root of the `spring-cloud-aws-ses-sample`:
     docker-compose -f docker-compose.yml up -d
     
    See more information on localstack see here and here.

  • Constructor Details

    • MailSendingApplication

      public MailSendingApplication()
  • Method Details

    • main

      public static void main(String[] args)
    • sendAnEmail

      public static void sendAnEmail(MailSender mailSender, software.amazon.awssdk.services.ses.SesClient sesClient)
    • sendAnEmailWithAttachment

      public static void sendAnEmailWithAttachment(MailSender mailSender, software.amazon.awssdk.services.ses.SesClient sesClient)
      To send emails with attachments, you must provide the Java Mail API and an implementation of the API in the classpath. See the dependencies provided in this sample app. If you don't provider an implementation of the Java Mail API, you would get the following exception at runtime.
       java.lang.IllegalStateException: Not provider of jakarta.mail.util.StreamProvider was found
       
      Parameters:
      mailSender - A JavaMailSender.
      sesClient - An SesClient.
    • sendHtmlEmail

      public static void sendHtmlEmail(MailSender mailSender, software.amazon.awssdk.services.ses.SesClient sesClient)
      To send HTML emails, you must provide the Java Mail API and an implementation of the API in the classpath. See the dependencies provided in this sample app. If you don't provider an implementation of the Java Mail API, you would get the following exception at runtime.
       java.lang.IllegalStateException: Not provider of jakarta.mail.util.StreamProvider was found
       
      Parameters:
      mailSender - A JavaMailSender.
      sesClient - An SesClient.