This commit is contained in:
geek 2018-05-08 16:34:09 +09:00
parent 856ec27cda
commit 6d9d8b5b78
4 changed files with 30 additions and 14 deletions

View File

@ -216,7 +216,7 @@
<build> <build>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources/${environment}</directory> <directory>src/main/resources/${activatedProperties}</directory>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
</resources> </resources>

View File

@ -39,13 +39,25 @@ public class EmailSender {
public void sendSimpleEmail(Mail mail) throws MailException { public void sendSimpleEmail(Mail mail) throws MailException {
SimpleMailMessage message1 = new SimpleMailMessage(); // SimpleMailMessage message1 = new SimpleMailMessage();
message1.setTo(mail.getMailTo()); // message1.setTo(mail.getMailTo());
message1.setSubject(mail.getMailSubject()); // message1.setSubject(mail.getMailSubject());
message1.setText(getContentFromTemplate(mail.getModel(), mail)); // message1.setText(getContentFromTemplate(mail.getModel(), mail));
message1.setFrom("geek@loafle.com"); // 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 { public void sendMailWithAttachment(Mail mail) throws MessagingException {

View File

@ -182,11 +182,11 @@ public class EmailAuthService {
if (status == 1) { if (status == 1) {
mailSubject = "Signup Confirm Mail"; mailSubject = "Signup Confirm Mail";
entry = "confirm_signup"; entry = "confirm_signup";
templateName = "./vmtemplates/signup.vm"; templateName = "/vmtemplates/signup.vm";
} else if (status == 2) { } else if (status == 2) {
mailSubject = "Reset Password Confirm Mail"; mailSubject = "Reset Password Confirm Mail";
entry = "confirm_reset_pw"; entry = "confirm_reset_pw";
templateName = "./vmtemplates/password_reset.vm"; templateName = "/vmtemplates/password_reset.vm";
} }
Mail mail = new Mail(); Mail mail = new Mail();

View File

@ -1,6 +1,10 @@
resource.loader=jar #resource.loader=jar
jar.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader #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.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
jar.runtime.log.logsystem.log4j.category=velocity #jar.runtime.log.logsystem.log4j.category=velocity
jar.resource.loader.cache=true #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 input.encoding=UTF-8