Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

The Easiest Way To Send Email Through AWS Simple Email Service (SES) In Scala.

 import ses4s._

val emailService = EmailServiceImpl() // for default region, or pass in a AmazonSimpleEmailService
emailService.sendEmail(Email(
  from = "stewie.griffin@gmail.com",
  to = "peter.griffin@gmail.com",
  subject = "Ha ha, ha hahaha",
  content = HTML("<h1>Victory is mine!</h1>"),
  attachments = Seq(Attachment(
    fileName = "world-domination.pdf", 
    mimeType = "application/pdf", 
    bytes = ...))
))

Getting Started

Just add these two lines to your build.sbt:

resolvers += Resolver.bintrayRepo("jcarver989", "maven")
libraryDependencies += "com.jcarver989" %% "aws-ses4s" % "latest.integration"

Usage

1. Get an Email Service

import ses4s._
val emailService = EmailServiceImpl() // for default region, or pass in a AmazonSimpleEmailService

OR

import com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClientBuilder
import ses4s._

val client = AmazonSimpleEmailServiceClientBuilder.standard().withRegion(Regions.US_EAST_1).build()
val emailService = new EmailServiceImpl(client)

2. Send An Email

HTML

 emailService.sendEmail(Email(
   fromName = "Stewie Griffin (Baby Genius)",
   fromEmail = "stewie.griffin@gmail.com",
   toEmail = "peter.griffin@gmail.com",
   subject = "Ha ha, ha hahaha",
   content = HTML("<h1>Victory is mine!</h1>"
   headers = Map("Foo" -> "Bar") // optional custom email headers
 )))

Text

 emailService.sendEmail(Email(
   from = "stewie.griffin@gmail.com",
   to = "peter.griffin@gmail.com",
   subject = "Ha ha, ha hahaha",
   content = Text("Victory is mine!")
 ))

Attachments

 emailService.sendEmail(Email(
   from = "stewie.griffin@gmail.com",
   to = "peter.griffin@gmail.com",
   subject = "Ha ha, ha hahaha",
   content = HTML("<h1>Victory is mine!</h1>"),
   attachments = Seq(Attachment(
     fileName = "world-domination.pdf",
     mimeType = "application/pdf",
     bytes = ...))
 ))

About

The simplest way to send email through AWS SES

Resources

License

Releases

No releases published

Packages

No packages published

Languages