Skip to content
Snippets Groups Projects
Commit a3575b3e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when smtp server is not configured, we are not trying to send email

parent fe45cf5b
No related branches found
No related tags found
1 merge request!67Resolve "Clicking on map with private comments might produce an error"
......@@ -32,33 +32,33 @@ public class EmailSender {
/**
* Default class logger.
*/
private Logger logger = Logger.getLogger(EmailSender.class);
private Logger logger = Logger.getLogger(EmailSender.class);
/**
* String (usualy email address) that should appear in sender field of the
* email.
*/
private String sender;
private String sender;
/**
* Login used for accessing mail account.
*/
private String login;
private String login;
/**
* Password used for accessing mail account.
*/
private String password;
private String password;
/**
* Server used for smtp.
*/
private String smtpHost;
private String smtpHost;
/**
* Port on the server used by imap.
*/
private String imapHost;
private String imapHost;
/**
* Port on the server used by smtp.
*/
private String smtpPort;
private String smtpPort;
/**
* Default constructor that initializes data.
......@@ -141,6 +141,10 @@ public class EmailSender {
* thrown when there is a problem with sending email
*/
public void sendEmail(List<String> recipients, List<String> ccRecipients, String subject, String message) throws MessagingException {
if (smtpHost.equals(ConfigurationElementType.EMAIL_SMTP_SERVER.getDefaultValue())) {
logger.warn("Cannot send email. No smpt server defined");
return;
}
// set data of the mail account
Properties props = System.getProperties();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment