if (mailLookupClass != null) {
Lookup lookup;
try {
lookup = (Lookup) Class.forName(mailLookupClass).newInstance();
} catch (Exception e) {
throw new MailException("Error in mail lookup class configuration: " + mailLookupClass, e);
}
jndi = lookup.getMailName();
} else {
jndi = Lookup.DEFAULT_MAIL_NAME;
}
try {
InitialContext ctx = new InitialContext();
session = (Session) ctx.lookup(jndi);
} catch (Exception e) {
throw new MailException("Error in lookup mail session " + jndi, e);
}
break;
default:
throw new MailException("Mail Type not implemented");
}
return session;
}