wynnhjg:
弱弱的问一下,appfuse里mail 的配置在哪里,偶找了数长时间找不到.
[阅读: 438] 2006-05-30 02:12:45
public static Session getSession() {
Session session = null;
try {
session =
(Session) new InitialContext().lookup("java:comp/env/" +
Constants.JNDI_MAIL);
} catch (NamingException ex) {
if (log.isDebugEnabled()) {
log.info("error communicating with JNDI, assuming testcase");
}
ResourceBundle mailProps = ResourceBundle.getBundle("mail");
Properties props = new Properties();
props.setProperty("mail.debug", mailProps.getString("mail.debug"));
props.setProperty("mail.transport.protocol",
mailProps.getString("mail.transport.protocol"));
props.setProperty("mail.host", mailProps.getString("mail.host"));
props.setProperty("mail.user", mailProps.getString("mail.user"));
props.setProperty("mail.password",
mailProps.getString("mail.password"));
session = Session.getDefaultInstance(props, null);
}
return session;
}