email token duplication check
This commit is contained in:
parent
6533a28d28
commit
908ef7ae34
@ -1,13 +1,13 @@
|
||||
package com.loafle.overflow.central.commons.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.mail.javamail.MimeMessagePreparator;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||
|
||||
@ -37,27 +37,18 @@ public class EmailSender {
|
||||
private String initVector = "loafleInitVector";
|
||||
|
||||
|
||||
public void sendSimpleEmail(Mail mail) throws MailException {
|
||||
public void sendSimpleEmail(final 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");
|
||||
// mailSender.send(message1);
|
||||
|
||||
MimeMessage msg = this.mailSender.createMimeMessage();
|
||||
|
||||
try {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(msg, false);
|
||||
MimeMessagePreparator preparator = mimeMessage -> {
|
||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true, "UTF-8");
|
||||
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();
|
||||
}
|
||||
helper.addInline("company-logo", new ClassPathResource("/vmtemplates/overFlow_logo.png"));
|
||||
};
|
||||
|
||||
this.mailSender.send(preparator);
|
||||
}
|
||||
|
||||
public void sendMailWithAttachment(Mail mail) throws MessagingException {
|
||||
@ -129,3 +120,26 @@ public class EmailSender {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 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);
|
||||
|
||||
|
||||
// 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);
|
||||
// helper.addInline("company-logo", new ClassPathResource("/vmtemplates/overFlow_logo.png"));
|
||||
// this.mailSender.send(msg);
|
||||
// } catch (MessagingException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
@ -17,11 +17,9 @@ import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.model.meta.MetaEmailStatus;
|
||||
import com.loafle.overflow.model.meta.MetaMemberStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
|
BIN
src/main/resources/local/vmtemplates/overFlow_logo.png
Normal file
BIN
src/main/resources/local/vmtemplates/overFlow_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@ -1,13 +1,72 @@
|
||||
<html>
|
||||
<xmeta charset="utf-8">
|
||||
<xmeta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<xmeta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<head></head>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" style="padding: 10px">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:5px solid #d5d8dc;max-width: 600px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 20px;text-align:center; background: #203976;">
|
||||
<img src="cid:company-logo" width="206" height="36" alt=""/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 40px 20px 0px 20px;font-family: Arial, Helvetica, Sans-serif;color: #383838;font-size: 1.3em; font-weight: bold;">
|
||||
Resset Your Password
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 30px 20px;font-family: Arial, Helvetica, Sans-serif; color: #383838;">
|
||||
|
||||
<body>
|
||||
<p>Dear ${firstName} ${lastName},</p>
|
||||
<p>Sending Email <b>${content}</b></p>
|
||||
<p>Thanks</p>
|
||||
<p>${signature}</p>
|
||||
<p>${location}</p>
|
||||
</body>
|
||||
<p>Dear ${firstName} ${lastName},</p>
|
||||
|
||||
</html>
|
||||
<p>Sending Email <b>${content}</b></p>
|
||||
|
||||
<table style="border-collapse: collapse; margin: 0 auto; color: #ffffff;" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr><td style="border: 0; padding: 0; margin: 0; mso-line-height-rule: exactly;" height="15"></td></tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle" style="text-align: center; text-decoration: none!important; text-transform: uppercase; font-weight: 400; font-size: 16px; font-family: Arial, Helvetica, Sans-serif; color: #ffffff; background-color: #2185d0; background-clip: border-box; border-top-left-radius: 4px; border-bottom-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; padding: 10px 30px 10px 30px;" width="100%">
|
||||
<a href="${content}" target="_blank" style="color: #ffffff; text-decoration: none;" rel="noreferrer noopener">RESSET PASSWORD NOW</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="border: 0; padding: 0; margin: 0; mso-line-height-rule: exactly;" height="15"></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Thanks</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 30px;font-family: Arial, Helvetica, Sans-serif;font-size: 0.8em; text-align:center;color:#eeeeee; background: #686868">
|
||||
<p>${signature}</p>
|
||||
|
||||
<p>${location}</p>
|
||||
|
||||
<p>Copyright ⓒ 2017 LOAFLE. All Rights Reserved.</p>
|
||||
<p><a href="" target="_blank" style="color:#eeeeee;">Help Center</a> ·
|
||||
<a href="" target="_blank" style="color:#eeeeee;">Privacy Policy</a> ·
|
||||
<a href="" target="_blank" style="color:#eeeeee;">Terms & Conditions</a></p>
|
||||
<p><a href="" style="color:#eeeeee;">Unsubscribe from this email</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</xmeta>
|
||||
</xmeta>
|
||||
</xmeta>
|
||||
|
@ -1,3 +1,77 @@
|
||||
<xmeta charset="utf-8">
|
||||
<xmeta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<xmeta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" style="padding: 10px">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:5px solid #d5d8dc;max-width: 600px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 20px;text-align:center; background: #203976;">
|
||||
<img src="cid:company-logo" width="206" height="36" alt=""/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 40px 20px 0px 20px;font-family: Arial, Helvetica, Sans-serif;color: #383838;font-size: 1.3em; font-weight: bold;">
|
||||
Welcome to overFlow. Please Confirm your Email
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 30px 20px;font-family: Arial, Helvetica, Sans-serif; color: #383838;">
|
||||
|
||||
<p>Dear ${firstName} ${lastName},</p>
|
||||
|
||||
<p>Sending Email <b>${content}</b></p>
|
||||
|
||||
<table style="border-collapse: collapse; margin: 0 auto; color: #ffffff;" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr><td style="border: 0; padding: 0; margin: 0; mso-line-height-rule: exactly;" height="15"></td></tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle" style="text-align: center; text-decoration: none!important; text-transform: uppercase; font-weight: 400; font-size: 16px; font-family: Arial, Helvetica, Sans-serif; color: #ffffff; background-color: #2185d0; background-clip: border-box; border-top-left-radius: 4px; border-bottom-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; padding: 10px 30px 10px 30px;" width="100%">
|
||||
<a href="${content}" target="_blank" style="color: #ffffff; text-decoration: none;" rel="noreferrer noopener">Register Now</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td style="border: 0; padding: 0; margin: 0; mso-line-height-rule: exactly;" height="15"></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Thanks</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 30px;font-family: Arial, Helvetica, Sans-serif;font-size: 0.8em; text-align:center;color:#eeeeee; background: #686868">
|
||||
<p>${signature}</p>
|
||||
|
||||
<p>${location}</p>
|
||||
|
||||
<p>Copyright ⓒ 2017 LOAFLE. All Rights Reserved.</p>
|
||||
<p><a href="" target="_blank" style="color:#eeeeee;">Help Center</a> ·
|
||||
<a href="" target="_blank" style="color:#eeeeee;">Privacy Policy</a> ·
|
||||
<a href="" target="_blank" style="color:#eeeeee;">Terms & Conditions</a></p>
|
||||
<p><a href="" style="color:#eeeeee;">Unsubscribe from this email</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</xmeta>
|
||||
</xmeta>
|
||||
</xmeta>
|
||||
|
||||
|
||||
<html>
|
||||
|
||||
<head></head>
|
||||
|
Loading…
x
Reference in New Issue
Block a user