Send an Email Through the Amazon SES SMTP Interface with scala

Table of contents
Reading Time: 2 minutes

The following procedure shows you how to use AWS Toolkit for IntelliJ to create an AWS SDK project and modify the scala code to send an email through Amazon SES.

In this getting started tutorial, you send an email to yourself so that you can check to see if you received it. For further experimentation or load testing, use the Amazon SES mailbox simulator.

Prerequisites – Before you begin, perform the following tasks:

  1. Verify your email address with Amazon SES – Before you can send an email with Amazon SES, you must verify that you own the sender’s email address. If your account is still in the Amazon SES sandbox, you must also verify the recipient email address. The easiest way to verify email addresses is by using the Amazon SES console. For more information, see Verification Procedures
  2.  Get your AWS credentials — You need an AWS access key ID and AWS secret access key to access Amazon SES using an SDK. You can find your credentials by using the Security Credentials page in the AWS Management Console. For more information about credentials, see Using Credentials With Amazon SES.
  3.  you shold have IntelliJ or Eclipse
  4.  Install the AWS Toolkit – you can use dependecies for AWS Toolkit libraryDependencies += "com.amazonaws" % "aws-java-sdk" % "1.11.152"
  5. Create a shared credentials file – you must create a shared credentials file.

Procedure

The following procedure shows how to send an email through Amazon SES using the AWS SDK for scala.

  • Create an sbt scala Project in IntelliJ
  • Add the above dependency in to build.sbt
  • Replace the entire contents of AmazonSES MailingApi.scala with the following code:

The Whole code present HERE


KNOLDUS-advt-sticker

Written by 

Shubham is a Software Consultant, with experience of more than 1.5 years.He is familiar with Object Oriented Programming Paradigms. He is always eager to learn new and advance concepts. Aside from being a programmer, his hobbies include playing badminton,watching movies, writing blogs. He has experience working in C, C++, CoreJava, Adv Java, HTML, CSS, JS, Ajax.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading