fix: 邮件自定义
This commit is contained in:
@@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.thymeleaf.TemplateEngine;
|
import org.thymeleaf.TemplateEngine;
|
||||||
import org.thymeleaf.context.Context;
|
import org.thymeleaf.context.Context;
|
||||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|
||||||
import org.wfc.common.core.constant.Constants;
|
import org.wfc.common.core.constant.Constants;
|
||||||
import org.wfc.common.core.constant.GlobalConstants;
|
import org.wfc.common.core.constant.GlobalConstants;
|
||||||
import org.wfc.common.core.domain.R;
|
import org.wfc.common.core.domain.R;
|
||||||
@@ -56,8 +55,6 @@ public class SysEmailController extends BaseController {
|
|||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.setVariable("verificationCode", code);
|
context.setVariable("verificationCode", code);
|
||||||
context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION);
|
context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION);
|
||||||
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
|
||||||
templateEngine.setTemplateResolver(resolver);
|
|
||||||
String htmlStr = templateEngine.process("mail", context);
|
String htmlStr = templateEngine.process("mail", context);
|
||||||
MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr);
|
MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ spring:
|
|||||||
port: 6379
|
port: 6379
|
||||||
password:
|
password:
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
prefix: /opt/wfc/templates
|
prefix: file:/opt/wfc/templates/
|
||||||
suffix: .html
|
suffix: .html
|
||||||
|
cache: false
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.thymeleaf.TemplateEngine;
|
import org.thymeleaf.TemplateEngine;
|
||||||
import org.thymeleaf.context.Context;
|
import org.thymeleaf.context.Context;
|
||||||
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
|
|
||||||
import org.wfc.common.core.constant.Constants;
|
import org.wfc.common.core.constant.Constants;
|
||||||
import org.wfc.common.core.constant.GlobalConstants;
|
import org.wfc.common.core.constant.GlobalConstants;
|
||||||
import org.wfc.common.core.domain.R;
|
import org.wfc.common.core.domain.R;
|
||||||
@@ -56,8 +55,6 @@ public class UEmailController extends BaseController {
|
|||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.setVariable("verificationCode", code);
|
context.setVariable("verificationCode", code);
|
||||||
context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION);
|
context.setVariable("expirationTime", Constants.MAIL_CAPTCHA_EXPIRATION);
|
||||||
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
|
|
||||||
templateEngine.setTemplateResolver(resolver);
|
|
||||||
String htmlStr = templateEngine.process("mail", context);
|
String htmlStr = templateEngine.process("mail", context);
|
||||||
MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr);
|
MailUtils.sendHtml(email, "Your WANFI verification code", htmlStr);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ spring:
|
|||||||
port: 6379
|
port: 6379
|
||||||
password:
|
password:
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
prefix: /opt/wfc/templates
|
prefix: file:/opt/wfc/templates/
|
||||||
suffix: .html
|
suffix: .html
|
||||||
|
cache: false
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
stat-view-servlet:
|
stat-view-servlet:
|
||||||
|
|||||||
Reference in New Issue
Block a user