def sendEmail()

in app/com/gu/viewer/controllers/Email.scala [21:43]


  def sendEmail(path: String) = APIAuthAction { req =>
    val email = req.user.email
    var emailList = new java.util.ArrayList[String]()
    emailList.add(email)

    val from = "editorial.tools.dev@theguardian.com"
    val to = new Destination(emailList)

    val message = new Message(
      new Content(s"Preview URLs for '$path'"),
      new Body(new Content(formatEmail(path)))
    )

    val emailReq = new SendEmailRequest(from, to, message)

    try {
      emailClient.sendEmail(emailReq)
      Ok
    } catch {
      case NonFatal(e) =>
        InternalServerError
    }
  }