k4200’s notes and thoughts

Programmer side of k4200

Email related settings in Lift

I think Lift's MegaProtoUser is a good starting point when you want to create a web site that requires user management. It basically gives you the basic features for those sites, such as sign-up form, confirmation email and password reset.

When a user submits the sign-up form, an email will be sent to him. But, you might want to customize the email settings. I'll get you through the code and settings for changing the behavior.

Settings and code

SMTP server

The default SMTP server that Lift uses is "localhost". To change it, add an entry like the following in your project's property file.


You should find a file named default.props, production.default.props or some such under /src/main/resources/props/ . That's the property file.

The property is used in net.liftweb.util.Mailer object.

From: field

The default value of "From" header is "noreply@". This is defined in net.liftweb.proto.ProtoUser.scala.

You can override this in your User object, which extends MetaMegaProtoUser.

Mail subject and boy

In net.liftweb.proto.ProtoUser trait, you'll also see the methods listed below:

  1. signupMailSubject
  2. signupMailBody
  3. passwordResetEmailSubject
  4. passwordResetMailBody

You can override these methods in your User singleton object.

It's not that elegant that ProtoUser holds subject and body text, but at least it's customizable.


Lift offers variety of ready-to-use features. It also gives you flexibility of customizing the behavior. This entry explains how to customize email related features with pointers to the source code. I hope this will help some of you.