public EagleMailClient(AbstractConfiguration configuration) { try { ConcurrentMapConfiguration con = (ConcurrentMapConfiguration)configuration; velocityEngine = new VelocityEngine(); velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath"); velocityEngine.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName()); velocityEngine.init(); con.setProperty("mail.transport.protocol", "smtp"); final Properties config = con.getProperties(); if(Boolean.parseBoolean(config.getProperty(AUTH_CONFIG))){ session = Session.getDefaultInstance(config, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(config.getProperty(USER_CONFIG), config.getProperty(PASSWORD_CONFIG)); } }); } else session = Session.getDefaultInstance(config, new Authenticator() {}); final String debugMode = config.getProperty(DEBUG_CONFIG, "false"); final boolean debug = Boolean.parseBoolean(debugMode); session.setDebug(debug); } catch (Exception e) { LOG.error("Failed connect to smtp server",e); } }