Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Mailer: Consider merging System.properties into Props #73

Closed
d6y opened this Issue Sep 23, 2009 · 3 comments

Comments

Projects
None yet
3 participants
Owner

d6y commented Sep 23, 2009

Rather than using System.getProperties should Mailer use
net.liftweb.util.Props? It seems a little inconsistent as is.
-harryh

This makes sense for me too. In our live lift app we have code in Boot to just copy props (that we happen to have named the same as the System mail properties) to System.properties:


 // props starting "mail.smtp." just need to be copied to System.properties:
 Props.props.filter(_._1 startsWith "mail.smtp").foreach( entry => System.setProperty(entry._1, entry._2) )
    
    //  Set up SMTP auth if a username and password is supplied
    Mailer.authenticator = (Props.get("mail.user"), Props.get("mail.password")) match {
      case (Full(u), Full(p)) => Full(new javax.mail.Authenticator {
          override def getPasswordAuthentication = new javax.mail.PasswordAuthentication(u,p)
        })
      case _ => Empty
    }

...and that seems a little messy, although not particularly painful.

I'd expect any explicitly set System.properties (-D flags) to take precedence over any in Props, but that's maybe just my taste (and almost the exact opposite of the code we've written!).

Owner

dpp commented Sep 23, 2009

This was done in the latest mailer commit

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment