Skip to content

Instantly share code, notes, and snippets.

@momota10
Last active January 18, 2016 09:37
Show Gist options
  • Select an option

  • Save momota10/761d288466298e5fae6f to your computer and use it in GitHub Desktop.

Select an option

Save momota10/761d288466298e5fae6f to your computer and use it in GitHub Desktop.
play-mailerを使ったメール送信メソッド
def sendEmail = Action.async { implicit request =>
emailAddressForm.bindFromRequest.fold(
error => {
Future.successful(BadRequest("Your Aoolication"))
},
emailAddress => {
//mail transfer process
val email = Email(
"Simple email",
"title <aaa@hoge.com>",
Seq(""+ emailAddress.email +" <"+ emailAddress.email +">"),
bodyHtml = Some(
"早安<br>" +
"我想吃魯肉飯"
)
)
mailer.send(email)
Future.successful(Ok(views.html.index("Your new application is ready.")))
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment