properties = new Properties();
try {
final File file = new File(System.getProperty(USER_HOME), PROPERTIES_FILE_NAME);
properties.load(new FileInputStream(file));
} catch (IOException e) {
throw new ConfigurationException("Error loading mail.properties", e);
}
// validate properties
mailUser = properties.getProperty(MAIL_USER);
if (GenericValidator.isBlankOrNull(mailUser)) {
throw new ConfigurationException("Property 'mail.user' cannot be blank or null");
}
mailPassword = properties.getProperty(MAIL_PASSWORD);
if (GenericValidator.isBlankOrNull(mailPassword)) {
throw new ConfigurationException("Property 'mail.password' cannot be blank or null");
}
try {
recipient = new InternetAddress(properties.getProperty(RECIPIENT_PROPERTY));
} catch (AddressException e) {
throw new ConfigurationException("Property 'recipient' must be a valid email address", e);
}
}