bitcoin-atm

bitcoin atm for pyc inc.

git clone https://9o.is/git/bitcoin-atm.git

Mailer.scala

(964B)


      1 package inc.pyc.chimera
      2 package lib
      3 
      4 import com.coiney.akka.mailer._
      5 import providers._
      6 import protocol._
      7 import System._
      8 import net.liftweb.util._
      9 
     10 /**
     11  * Sends out email.
     12  */
     13 object Mailer {
     14 
     15   /**
     16    * Mailing System
     17    */
     18   val mailerSystem = MailerSystem()
     19   
     20   def apply(to: String, subject: String, body: String): Unit = 
     21     if(Props.productionMode) {
     22       try {
     23         new SmtpProvider(mailerSystem.settings)
     24           .getMailer
     25           .sendEmail(
     26               Email(
     27                 subject = subject,
     28                 from = Correspondent(
     29                     Settings(system).smtpEmail, 
     30                     Settings(system).smtpSender),
     31                 to = Correspondent(to.trim.toLowerCase) :: Nil,
     32                 html = Some(body)
     33               )
     34           )
     35       } catch {
     36         case _: java.lang.IllegalArgumentException =>
     37         case _: Throwable => 
     38       }
     39     } else {
     40       println("Email to $s: %s" format (to, subject))
     41     }
     42 }