diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index bcd920022..41f26a577 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.application.core.impls; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; +import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; @@ -11,6 +12,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.LoginInfo; import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.manage.system.core.MailGunService; @@ -21,7 +23,6 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.NotFoundException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.locale.LocaleSupport; -import au.com.royalpay.payment.tools.mail.SendMail; import au.com.royalpay.payment.tools.utils.PasswordUtils; import com.alibaba.fastjson.JSONObject; @@ -44,10 +45,8 @@ import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; import java.util.Random; -import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -72,6 +71,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @Resource private MailGunService mailGunService; @Resource + private MailService mailService; + @Resource private SpringTemplateEngine thymeleaf; @Resource private ClientManager clientManager; @@ -163,15 +164,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { Context ctx = new Context(); ctx.setVariable("url", PlatformEnvironment.getEnv().concatUrl("/register/account/mail/" + address + "/verify/" + key + "/jump?username=" + username)); final String content = thymeleaf.process("mail/register_application", ctx); - SendMail sendMail = new SendMail(); - Set to = new HashSet<>(); - to.add(address); - sendMail.setMailTos(to); - sendMail.setFrom("info@mail.royalpay.com.au"); - sendMail.setTitle("Royalpay"); - sendMail.setContent(content); - sendMail.setTags(tags); - mailGunService.sendMail(sendMail); +// SendMail sendMail = new SendMail(); +// Set to = new HashSet<>(); +// to.add(address); +// sendMail.setMailTos(to); +// sendMail.setFrom("info@mail.royalpay.com.au"); +// sendMail.setTitle("Royalpay"); +// sendMail.setContent(content); +// sendMail.setTags(tags); +// mailGunService.sendMail(sendMail); + + try { + String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", address, + "", content); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } }