Improve message for SMTP server not configured.

This commit is contained in:
Paulo Gustavo Veiga 2012-06-30 19:16:18 -03:00
parent 538e0196e2
commit cd46647602
2 changed files with 25 additions and 13 deletions

View File

@ -117,6 +117,7 @@ final public class NotificationService {
} }
private void handleException(Exception e) { private void handleException(Exception e) {
System.err.println("An expected error has occurred trying to send an email notification. Usually, the main reason for this is that the SMTP server properties has not been configured properly. Edit the WEB-INF/app.properties file and verify the SMTP server configuration properties.");
e.printStackTrace(); e.printStackTrace();
} }
@ -136,12 +137,16 @@ final public class NotificationService {
} }
public void sendRegistrationEmail(@NotNull User user) { public void sendRegistrationEmail(@NotNull User user) {
final Map<String, Object> model = new HashMap<String, Object>(); try {
model.put("user", user); final Map<String, Object> model = new HashMap<String, Object>();
final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode(); model.put("user", user);
model.put("emailcheck", activationUrl); final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode();
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Welcome to Wisemapping!", model, model.put("emailcheck", activationUrl);
"confirmationMail.vm"); mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Welcome to Wisemapping!", model,
"confirmationMail.vm");
} catch (Exception e) {
handleException(e);
}
} }
public void reportMindmapEditorError(@NotNull MindMap mindmap, @NotNull User user, @NotNull String userAgent, @Nullable String jsErrorMsg) { public void reportMindmapEditorError(@NotNull MindMap mindmap, @NotNull User user, @NotNull String userAgent, @Nullable String jsErrorMsg) {

View File

@ -24,6 +24,13 @@ database.password=
#------------------------ #------------------------
# Plain SMTP Server Configuration # Plain SMTP Server Configuration
#------------------------ #------------------------
mail.smtp.port=465
mail.smtp.host=localhost
mail.username=root
mail.password=
mail.smtp.auth=false
mail.smtp.starttls.enable=false
mail.smtp.quitwait=false
#------------------------ #------------------------
# SSL SMTP Server Configuration # SSL SMTP Server Configuration
@ -32,13 +39,13 @@ database.password=
#------------------------ #------------------------
# GMAIL SMTP Configuration # GMAIL SMTP Configuration
#------------------------ #------------------------
mail.smtp.port=587 #mail.smtp.port=587
mail.smtp.host=smtp.gmail.com #mail.smtp.host=smtp.gmail.com
mail.username=<gmail-user-account> #mail.username=<gmail-user-account>
mail.password=<gmail-password> #mail.password=<gmail-password>
mail.smtp.auth=true #mail.smtp.auth=true
mail.smtp.starttls.enable=true #mail.smtp.starttls.enable=true
mail.smtp.quitwait=false #mail.smtp.quitwait=false
#------------------------ #------------------------
# Emails configuration # Emails configuration