how do you set system properties in lift?

9 views
Skip to first unread message

george

unread,
Sep 8, 2009, 1:03:31 PM9/8/09
to Lift
say I wanted to change the port / host that the Mailer uses.

how would I go about that?

thanks

Tim Nelson

unread,
Sep 8, 2009, 2:29:12 PM9/8/09
to lif...@googlegroups.com
You need to set system properties:

System.setProperty("mail.smtp.starttls.enable","true");
        System.setProperty("mail.smtp.host", host)
        System.setProperty("mail.smtp.port", "587")
        System.setProperty("mail.smtp.auth", "true")
        Mailer.authenticator = Full(new Authenticator {
            override def getPasswordAuthentication =
                new PasswordAuthentication(user, password)
        })

Tim

jon

unread,
Sep 8, 2009, 2:46:55 PM9/8/09
to Lift
Note that if you're on 1.1-SNAPSHOT you can set customProperties on
the Mailer which would allow to use some other configuration mechanism
than system property (like Props or Configgy).

val props = Map[String,String]("mail.smtp.host" -> "...")

Mailer.customProperties = props
Mailer.authenticator = Full(new Authenticator(){
override def getPasswordAuthentication = new
PasswordAuthentication("f...@foo.com","bar")
})


Mailer.buildProps would return the Properties the Mailer is currently
using.

- Jon
Reply all
Reply to author
Forward
0 new messages