forked from themillhousegroup/play2-mailgun
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
120 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
language: scala | ||
scala: | ||
- "2.11.7" | ||
- "2.11.11" | ||
jdk: | ||
- oraclejdk8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ Features: | |
- Super-easy to wire in (just add two values to `application.conf`) | ||
- Send plain-text and/or HTML emails _with the one Twirl template_ (not finished yet) | ||
|
||
[![Build Status](https://travis-ci.org/themillhousegroup/play2-mailgun.svg?branch=master)](https://travis-ci.org/themillhousegroup/play2-mailgun) | ||
[![Build Status](https://travis-ci.org/playalot/play2-mailgun.svg?branch=master)](https://travis-ci.org/playalot/play2-mailgun) | ||
|
||
|
||
|
||
|
@@ -24,7 +24,7 @@ Add the following to your ```build.sbt```: | |
``` | ||
|
||
#### Pick the right version for your Play app | ||
There are versions available for Play 2.3 to 2.5. | ||
There are versions available for Play 2.3 to 2.5. | ||
|
||
If you are on Play 2.5, you'll need to use the latest from the `0.3.x` family, as shown below: | ||
|
||
|
@@ -73,7 +73,7 @@ val m = EmailMessage( | |
``` | ||
|
||
##### Sender addressing | ||
You might have noticed the first argument to `EmailMessage` was `Some("[email protected]")` - | ||
You might have noticed the first argument to `EmailMessage` was `Some("[email protected]")` - | ||
if you want emails to come from different senders depending on context, you should pass the sender's | ||
email address in like this. | ||
|
||
|
@@ -93,7 +93,7 @@ It returns a `Future[MailgunResponse]` (which you can ignore if you don't care): | |
##### Play 2.3 static-object style: | ||
|
||
``` | ||
import com.themillhousegroup.play2.mailgun.MailgunEmailService | ||
import cn.playalot.play2.mailgun.MailgunEmailService | ||
... | ||
|
@@ -107,7 +107,7 @@ MailgunEmailService.send(m).map { mailgunResponse => | |
``` | ||
import play.api.mvc._ | ||
import com.google.inject.Inject | ||
import com.themillhousegroup.play2.mailgun.MailgunEmailService | ||
import cn.playalot.play2.mailgun.MailgunEmailService | ||
class MyController @Inject() (val emailService:MailgunEmailService) extends Controller { | ||
|
@@ -169,7 +169,7 @@ val replyToEmail = MulticastEmailMessage( | |
Use one custom template (with `.scala.email` extension) to define both plain text and HTML message bodies. | ||
|
||
### Credits / References | ||
- [MailGun](http://www.mailgun.com/) | ||
- [MailGun](http://www.mailgun.com/) | ||
- [This Issue in Play](https://github.com/playframework/playframework/issues/902) | ||
- [This Stack Overflow question](http://stackoverflow.com/questions/10890362/play-2-0-how-to-post-multipartformdata-using-ws-url-or-ws-wsrequest) | ||
- [Play Custom Template Formats](https://www.playframework.com/documentation/2.3.x/ScalaCustomTemplateFormat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,74 @@ | ||
import scalariform.formatter.preferences._ | ||
|
||
name := "play2-mailgun" | ||
|
||
val deps = Seq( | ||
"com.typesafe.play" %% "play-ws" % "2.5.3" % "provided", | ||
"com.typesafe.play" %% "play-json" % "2.6.7" % "provided", | ||
"com.typesafe.play" %% "play-ws" % "2.6.7" % "provided", | ||
"org.mockito" % "mockito-all" % "1.10.19" % "test", | ||
"org.specs2" %% "specs2" % "2.3.13" % "test", | ||
"commons-fileupload" % "commons-fileupload" % "1.3.1" % "test", | ||
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "test" | ||
"org.specs2" %% "specs2" % "2.5" % "test", | ||
"commons-fileupload" % "commons-fileupload" % "1.3.3" % "test", | ||
"javax.servlet" % "javax.servlet-api" % "4.0.0" % "test" | ||
) | ||
|
||
lazy val commonSettings = Seq( | ||
organization := "com.themillhousegroup", | ||
organization := "cn.playalot", | ||
// If the CI supplies a "build.version" environment variable, inject it as the rev part of the version number: | ||
version := s"${sys.props.getOrElse("build.majorMinor", "0.3")}.${sys.props.getOrElse("build.version", "SNAPSHOT")}", | ||
scalaVersion := "2.11.7", | ||
version := "2.6.7", | ||
scalaVersion := "2.12.4", | ||
crossScalaVersions := Seq("2.11.11", "2.12.4"), | ||
crossVersion := CrossVersion.binary, | ||
libraryDependencies ++= deps | ||
) | ||
|
||
lazy val publishSettings = Seq( | ||
organization := "cn.playalot", | ||
publishMavenStyle := true, | ||
publishArtifact in Test := false, | ||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (isSnapshot.value) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
}, | ||
pomExtra := | ||
<url>http://github.com/playalot/play2-mailgun</url> | ||
<licenses> | ||
<license> | ||
<name>Apache 2</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>github.com:playalot/play2-mailgun.git</url> | ||
<connection>scm:git:github.com:playalot/play2-mailgun.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>gguan</id> | ||
<name>Guan Guan</name> | ||
<url>http://github.com/gguan</url> | ||
</developer> | ||
</developers>) | ||
|
||
|
||
lazy val root = project.in(file(".")).settings(commonSettings:_*) | ||
lazy val templating = project.in(file("templating")).settings(commonSettings:_*) | ||
|
||
lazy val root = project.in(file(".")).settings(commonSettings:_*).settings(publishSettings: _*) | ||
lazy val templating = project.in(file("templating")).settings(commonSettings:_*) | ||
|
||
resolvers ++= Seq( "oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", | ||
"oss-releases" at "https://oss.sonatype.org/content/repositories/releases", | ||
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/") | ||
|
||
jacoco.settings | ||
resolvers ++= Seq( | ||
"oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", | ||
"oss-releases" at "https://oss.sonatype.org/content/repositories/releases", | ||
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/") | ||
|
||
publishArtifact in (Compile, packageDoc) := false | ||
|
||
seq(bintraySettings:_*) | ||
|
||
licenses += ("MIT", url("http://opensource.org/licenses/MIT")) | ||
|
||
scalariformSettings | ||
|
||
net.virtualvoid.sbt.graph.Plugin.graphSettings | ||
|
||
scalariformPreferences := scalariformPreferences.value | ||
.setPreference(AlignSingleLineCaseStatements, true) | ||
.setPreference(DoubleIndentConstructorArguments, true) | ||
.setPreference(DanglingCloseParenthesis, Preserve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3") | ||
|
||
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6") | ||
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2") | ||
|
||
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") | ||
|
||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.6") | ||
|
||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4") | ||
|
||
resolvers += Resolver.url( | ||
"bintray-sbt-plugin-releases", | ||
url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))( | ||
Resolver.ivyStylePatterns) | ||
|
||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1.2") | ||
|
||
|
||
// Uncomment if this is a Scala 2.11(+) project to get scapegoat linting: | ||
//addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "0.94.6") | ||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.3") |
2 changes: 1 addition & 1 deletion
2
...usegroup/play2/mailgun/EmailMessage.scala → ...playalot/play2/mailgun/EmailMessage.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.themillhousegroup.play2.mailgun | ||
package cn.playalot.play2.mailgun | ||
|
||
import java.io.File | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...egroup/play2/mailgun/MailgunOptions.scala → ...ayalot/play2/mailgun/MailgunOptions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/scala/cn/playalot/play2/mailgun/MailgunResponse.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package cn.playalot.play2.mailgun | ||
|
||
case class MailgunResponse(message: String, id: String) { | ||
lazy val status: MailgunSentMessageStatus = MessageQueued | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/scala/cn/playalot/play2/mailgun/MailgunResponseJson.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cn.playalot.play2.mailgun | ||
|
||
import play.api.libs.json.Json | ||
|
||
trait MailgunResponseJson { | ||
implicit val responseReads = Json.reads[MailgunResponse] | ||
} |
2 changes: 1 addition & 1 deletion
2
...ay2/mailgun/MailgunSendingException.scala → ...ay2/mailgun/MailgunSendingException.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/scala/cn/playalot/play2/mailgun/MailgunSentMessageStatus.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package cn.playalot.play2.mailgun | ||
|
||
trait MailgunSentMessageStatus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package cn.playalot.play2.mailgun | ||
|
||
case object MessageQueued extends MailgunSentMessageStatus |
5 changes: 2 additions & 3 deletions
5
...lay2/mailgun/utils/DualFormatMarkup.scala → ...lay2/mailgun/utils/DualFormatMarkup.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/main/scala/com/themillhousegroup/play2/mailgun/MailgunResponse.scala
This file was deleted.
Oops, something went wrong.
8 changes: 3 additions & 5 deletions
8
.../play2-mailgun/DualFormatMarkupSpec.scala → .../play2/mailgun/DualFormatMarkupSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...roup/play2-mailgun/EmailMessageSpec.scala → ...alot/play2/mailgun/EmailMessageSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 5 additions & 12 deletions
17
...roup/play2-mailgun/EmailServiceSpec.scala → ...alot/play2/mailgun/EmailServiceSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
|
||
libraryDependencies ++= Seq( | ||
"com.themillhousegroup" %% "scoup" % "0.2.26" | ||
) | ||
|
||
|
||
resolvers ++= Seq( "oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", | ||
"oss-releases" at "https://oss.sonatype.org/content/repositories/releases", | ||
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/", | ||
"Millhouse Bintray" at "http://dl.bintray.com/themillhousegroup/maven" | ||
"org.jsoup" % "jsoup" % "1.10.3" | ||
) |
Oops, something went wrong.