diff --git a/pom.xml b/pom.xml index 54d614a..cb00cf0 100644 --- a/pom.xml +++ b/pom.xml @@ -216,7 +216,7 @@ - src/main/resources/${environment} + src/main/resources/${activatedProperties} true diff --git a/src/main/java/com/loafle/overflow/central/commons/utils/EmailSender.java b/src/main/java/com/loafle/overflow/central/commons/utils/EmailSender.java index 916c04a..896919a 100644 --- a/src/main/java/com/loafle/overflow/central/commons/utils/EmailSender.java +++ b/src/main/java/com/loafle/overflow/central/commons/utils/EmailSender.java @@ -39,13 +39,25 @@ public class EmailSender { public void sendSimpleEmail(Mail mail) throws MailException { - SimpleMailMessage message1 = new SimpleMailMessage(); - message1.setTo(mail.getMailTo()); - message1.setSubject(mail.getMailSubject()); - message1.setText(getContentFromTemplate(mail.getModel(), mail)); - message1.setFrom("geek@loafle.com"); +// SimpleMailMessage message1 = new SimpleMailMessage(); +// message1.setTo(mail.getMailTo()); +// message1.setSubject(mail.getMailSubject()); +// message1.setText(getContentFromTemplate(mail.getModel(), mail)); +// message1.setFrom("geek@loafle.com"); +// mailSender.send(message1); - mailSender.send(message1); + MimeMessage msg = this.mailSender.createMimeMessage(); + + try { + MimeMessageHelper helper = new MimeMessageHelper(msg, false); + helper.setTo(mail.getMailTo()); + helper.setFrom("geek@loafle.com"); + helper.setSubject(mail.getMailSubject()); + helper.setText(getContentFromTemplate(mail.getModel(), mail), true); + this.mailSender.send(msg); + } catch (MessagingException e) { + e.printStackTrace(); + } } public void sendMailWithAttachment(Mail mail) throws MessagingException { diff --git a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java index 25c2181..c42c936 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java +++ b/src/main/java/com/loafle/overflow/central/module/email/service/EmailAuthService.java @@ -182,11 +182,11 @@ public class EmailAuthService { if (status == 1) { mailSubject = "Signup Confirm Mail"; entry = "confirm_signup"; - templateName = "./vmtemplates/signup.vm"; + templateName = "/vmtemplates/signup.vm"; } else if (status == 2) { mailSubject = "Reset Password Confirm Mail"; entry = "confirm_reset_pw"; - templateName = "./vmtemplates/password_reset.vm"; + templateName = "/vmtemplates/password_reset.vm"; } Mail mail = new Mail(); diff --git a/src/main/resources/local/velocity.properties b/src/main/resources/local/velocity.properties index c298824..d2a5cc2 100644 --- a/src/main/resources/local/velocity.properties +++ b/src/main/resources/local/velocity.properties @@ -1,6 +1,10 @@ -resource.loader=jar -jar.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader -jar.runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem -jar.runtime.log.logsystem.log4j.category=velocity -jar.resource.loader.cache=true +#resource.loader=jar +#jar.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader +#jar.runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem +#jar.runtime.log.logsystem.log4j.category=velocity +#jar.resource.loader.cache=true +resource.loader=class +class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader +class.runtime.log.logsystem.log4j.category=velocity + input.encoding=UTF-8 \ No newline at end of file