中国开发网: 论坛: 程序员情感CBD: 贴子 333601
wynnhjg
弱弱的问一下,appfuse里mail 的配置在哪里,偶找了数长时间找不到.
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;
}

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录