String port = sm.getValue("system/feedback/mailServer/port");
String to = sm.getValue("system/feedback/email");
Log.debug(Geonet.FEEDBACK, "email settings.. host: " + host + " port: " + port + " email: " + to);
JavaMailer mailer = new JavaMailer(host, port, false, null, null);
if(StringUtils.isEmpty(NOREPLY)) {
NOREPLY = "noreply@geonetwork-opensource.org";
}
if(StringUtils.isNotEmpty(metadataEmail)) {
if(StringUtils.isNotEmpty(to)) {
mailer.send(subject, body, null, NOREPLY, to, metadataEmail);
}
else {
mailer.send(subject, body, null, NOREPLY, metadataEmail);
}
}
else {
if(StringUtils.isNotEmpty(to)) {
mailer.send(subject, body, null, NOREPLY, to);
}
else {
Element response = new Element("response");
response.setText("Feedback email not sent, because both the catalog system email and the metadata email were empty.");
}