title: Play Framework 2.4 sending email
body: <p>I'm new to Scala and I got stuck in sending an email...</p>
  
  <p>I'm working with Play! 2.4 and have to following in <strong>build.scala</strong> </p>
  
  <pre><code>"com.typesafe.play" %% "play-mailer" % "3.0.1"
  </code></pre>
  
  <p>In application.conf the following:</p>
  
  <pre><code>play.mailer {
      host=smtp.gmail.com
      port=587 
      ssl=true
      tls=true
      user="testme@gmail.com"
      password=abracadabra
      debug=true
  </code></pre>
  
  <p>}</p>
  
  <p>What I'm trying to do is to send an email to an user, for example user_1, when some other user, user_2, borrows a book from user_1.</p>
  
  <p>In my book controller I have this methods:</p>
  
  <pre><code>def sendEmail(email_user: String, subject: String, msg: String): Unit = { 
  
      val email = Email(
        subject,
        "FROM &lt;testme@gmail.com&gt;",
        Seq("TO &lt;"+email_user+"&gt;"),
  
        bodyText = Some(msg)
      )
  
  }
  </code></pre>
  
  <p>In the next method I call the <strong>sendEmail</strong> method if user_2 borrows a book from user_1</p>
  
  <pre><code>  def borrowBook(id_book: Long) = Action { implicit request =&gt;
       val nr = Book.checkBook(id_book)
       val date = new Date()      
  
       if(nr &gt; 0)
       {
          val list = Book.getCarte(id_book)
          val no = Friend.isFriend(list.id_user, userInfo.id.get)
          if(no == 1){ 
           Borrow.insert(Borrow(id_book, userInfo.id.get, date))
  
           sendEmail(userInfo.email, "Borrow book", "Your book has been borrowed")
           Ok(views.html.borrowBook())
           }else Ok(views.html.warningBorrow())
       }
       else Ok(views.html.failBorrow())
  
   }
  </code></pre>
  
  <p>The problem is that I don't receive any error or something like that and I don't know what I'm doing wrong.</p>
  
  <p>Can anyone please help me?</p>
  
  <p>Thank you very much!</p>