试试这样生成Session
public static synchronized Session getSMTPSession(Authenticator au)
  {
    Properties prop = new Properties();
    prop.put("mail.transport.protocol","smtp");
    prop.put("mail.host",Helper.HOST);
    prop.put("mail.transport.port",Helper.SMTP_PORT);    return Session.getInstance(prop,au);
  }这里的au是:
/*
 * Created on 2004-8-31
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.anson.mail;import javax.mail.PasswordAuthentication;
import javax.mail.Authenticator;
import java.io.Serializable;
/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class MailAuthenticator extends Authenticator implements Serializable
{
    public MailAuthenticator(String _username,String _password)
    {
        this.username = _username;
        this.password = _password;
    }    public  PasswordAuthentication getPasswordAuthentication()
    {
        return new PasswordAuthentication(username,password);
    }    public String getUsername()
    {
      return username;
    }    public String getPassword()
    {
      return password;
    }    private String username;
    private String password;
}