LoginSignup
1
1

More than 5 years have passed since last update.

playframework(2.2) + herokuでメール送信(SendGrid(heroku メールアドオン))

Posted at

SendGrid

playframework

playframework のプラグインはこちら。
https://github.com/typesafehub/play-plugins/tree/master/mailer

最新版は下記です。
"com.typesafe" %% "play-plugins-mailer" % "2.2.0"

conf/application.conf

smtp.host=smtp.sendgrid.net
smtp.port=587
smtp.user=[SENDGRID_USERNAME]
smtp.password=[SENDGRID_PASSWORD]

例に習って、以下のようなobjectを作る


import play.api.Play.current
import com.typesafe.plugin._

object Mailer {

  def send = {

    val mail = use[MailerPlugin].email

    mail.setSubject("mailer test")
    mail.setRecipient("[宛先メールアドレス]")

    mail.setFrom("[送信元メールアドレス]")
    mail.send( "text" )
  }

}

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1