Scandrill is an async Scala client for the MandrillApp API.
The release versions of Scandrill are built against Scala 2.11.x
If you're using SBT, add the following line to your build file:
libraryDependencies += "com.nitindhar" %% "scandrill" % "0.1.0"
For Maven and other build tools, you can visit search.maven.org.
To get sample configurations, click on the version of the module you are interested in.
You can also find direct download links at the bottom of that page. Choose the file ending in x.x.x.jar
.
import com.nitindhar.scandrill.client._
val scandrill = Scandrill("https://mandrillapp.com/api/1.0", API-KEY, DEFAULT-FROM-EMAIL, DEFAULT-FROM-NAME)
Using the Scandrill client
import com.nitindhar.scandrill.client._
import com.nitindhar.scandrill.models._
val template = render("welcome-email-template") // render your template to a string using whichever way you prefer
val subject = "Welcome Friend!"
val to = List("[email protected]")
scandrill.sendMessage(template, subject, to)
Handling the response from sendMessage
scandrill.sendMessage(...).map {
case Left(e) => Logger.info(s"Error occured: ${e.getMessage}")
case Right(resp) => Logger.info(s"Successfully sent ${resp.size} emails!")
}
Getting started with Mandril App
The sendMessage
endpoint is part of the Messages calls section
Check here to view the existing Mandrill App integrations.
- Create new examples
- Port/Write test cases
- Create documentation
- Class level documentation for each class.
- Brief method documentation welcome
- Review code base for consistency problems
- Review class hierarchy