hi all,

I'm new to lift, I met with a problem when trying to send a mail.

//Mail.scala---------------------------------------
package my.site
import net.liftweb.util._
import Helpers._
import Mailer._
import javax.mail._
import javax.mail.internet._
import xml._

object Mail {
  var from = ""

  def config(host: String, user: String, password: String) {
    System.setProperty("mail.smtp.starttls.enable","true");
    System.setProperty("mail.smtp.host", host)
    System.setProperty("mail.smtp.auth", "true")
    System.setProperty("mail.mime.charset", "UTF-8")
    Mailer.authenticator = Full(new Authenticator {
      override def getPasswordAuthentication =
        new PasswordAuthentication(user, password)
    })
    from = user
  }

  def send(to: String, xmlContent: NodeSeq) {
    sendMail(From(from), Subject("hi"),
      XHTMLMailBodyType(xmlContent)::To(to)::Nil : _* )
  }
}

//useMail.scala------------------------------------------
...
// host, user, password
my.site.Mail.config("smtp.gmail.com", "*...@gmail.com", "*****")
// the recieved mail body becomes "<p>??</p>"
my.site.Mail.send("*...@gmail.com", (<p>你好</p>))

All source files are UTF-8, and project.build.sourceEncoding is UTF-8
too.
Is there a missing step?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to