当前位置: 首页 > news >正文

心理咨询网站建设论文苏州网站设计公司兴田德润i网址多少

心理咨询网站建设论文,苏州网站设计公司兴田德润i网址多少,张家港网站建设门店,网站建设管理办法准备工作 开启SMTP服务 前往你的邮箱网站#xff0c;以网易邮箱为例#xff0c;打开网易邮箱地址#xff0c;登录你的邮箱#xff0c;进入邮箱管理后台界面。点击“设置”》》“POP3/SMTP/IMAP”后#xff0c;点击开启SMTP服务即可。 技术实现 Spring Boot 发送邮件验证…准备工作 开启SMTP服务 前往你的邮箱网站以网易邮箱为例打开网易邮箱地址登录你的邮箱进入邮箱管理后台界面。点击“设置”》》“POP3/SMTP/IMAP”后点击开启SMTP服务即可。 技术实现 Spring Boot 发送邮件验证码的功能主要用到了spring-boot-starter-mail工具包实现邮件的发送功能利用junit-vintage-engine工具包实现了html邮件模板功能利用easy-captcha工具包生成随机验证码 的功能 引入依赖 !--引入mail依赖--dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-mail/artifactId/dependency!--mail模板--dependencygroupIdorg.junit.vintage/groupIdartifactIdjunit-vintage-engine/artifactIdscopetest/scopeexclusionsexclusiongroupIdorg.hamcrest/groupIdartifactIdhamcrest-core/artifactId/exclusion/exclusions/dependency!--验证码--dependencygroupIdcom.github.whvcse/groupIdartifactIdeasy-captcha/artifactIdversion1.6.2/version/dependency相关配置 然后再spring的配置文件中设置mail相关配置 spring:mail:host: smtp.yeah.comusername: 你的邮箱password: 邮箱授权码default-encoding: UTF-8protocol: smtpproperties:mail:smtp:auth: true # 启用SMTP认证starttls:enabled: true # 启用SMTP认证required: true # 必须采用加密链接代码实现 创建一个MailService类实现邮件发送的功能代码如下 import com.tarzan.nav.modules.admin.service.sys.SysConfigService; import com.tarzan.nav.utils.DateUtil; import lombok.extern.slf4j.Slf4j; import org.antlr.stringtemplate.StringTemplate; import org.antlr.stringtemplate.StringTemplateGroup; import org.springframework.beans.factory.annotation.Value; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component;import javax.annotation.Resource; import javax.mail.MessagingException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeUtility; import java.io.UnsupportedEncodingException; import java.util.Objects;/*** author lsyong*/ Component(mailService) Slf4j public class MailService {private static final StringTemplateGroup templateGroup;Resourceprivate SysConfigService sysConfigService;static{String classpath Objects.requireNonNull(MailService.class.getClassLoader().getResource()).getPath();templateGroup new StringTemplateGroup(mailTemplates, classpath /mailTemplates);}public static String IMG_BASE_URL;public static String ACTIVATE_CONTEXThttp:;public static String RESET_PWD_CONTEXT;Value(${spring.mail.username})private String username;Resourceprivate JavaMailSender mailSender;private void sendMail(String to, String subject, String body) {MimeMessage mail mailSender.createMimeMessage(); try {MimeMessageHelper helper new MimeMessageHelper(mail, true, utf-8);helper.setFrom(new InternetAddress(MimeUtility.encodeText(sysConfigService.getSiteName())username).toString());helper.setTo(to);helper.setSubject(subject);helper.setText(body, true);helper.setSentDate(DateUtil.now());mailSender.send(mail);} catch (MessagingException|UnsupportedEncodingException e) {log.error(e.getMessage());}}/*** send activation mail to* param to,key*/public void sendAccountActivationEmail(String to, String key){StringTemplate activation_temp templateGroup.getInstanceOf(activation);activation_temp.setAttribute(img_base_url, IMG_BASE_URL);activation_temp.setAttribute(email, to);activation_temp.setAttribute(href, ACTIVATE_CONTEXTkey?emailto);activation_temp.setAttribute(link, ACTIVATE_CONTEXTkey?emailto);sendMail(to, sysConfigService.getSiteName()账户激活, activation_temp.toString());}Asyncpublic void sendEmailCode(String to, String code){StringTemplate activation_temp templateGroup.getInstanceOf(verificationCode);activation_temp.setAttribute(img_base_url, IMG_BASE_URL);activation_temp.setAttribute(email, to);activation_temp.setAttribute(code, code);sendMail(to, sysConfigService.getSiteName()邮箱验证码, activation_temp.toString());}/*** send change password link to* param to,key*/public void sendResetPwdEmail(String to, String key){StringTemplate activation_temp templateGroup.getInstanceOf(resetpwd);activation_temp.setAttribute(img_base_url, IMG_BASE_URL);activation_temp.setAttribute(href, RESET_PWD_CONTEXT?keykeyemailto);activation_temp.setAttribute(link, RESET_PWD_CONTEXT?keykeyemailto);sendMail(to, sysConfigService.getSiteName()账户密码重置, activation_temp.toString());} }
http://www.hkea.cn/news/14488023/

相关文章:

  • 做网站制作软件如何设计产品网站建设
  • 广州市 住房建设局网站网站开发怎么做到前后端
  • 达尔罕茂明安网站建设wordpress 界面英文
  • 优设网站怎么下载最好看的中文字幕国语电影有哪些
  • 网站备案的要求是什么室内设计优秀案例网站
  • 网站首页的文字下拉怎么做wordpress 取消边栏
  • 长沙做网站品牌如何做分公司网站
  • 大场网站建设水果行业为什么做网站
  • 海南省建设工程质量监督网站湛江网站建设方案维护
  • 登不上建设银行网站哪个网站使用vue 做的
  • 电商网站建设外包费用如何让网站做网页适配
  • 做动漫头像的网站友链购买网
  • 服务好的高端网站建设报价和女人做的电影网站
  • 单页网站在线制作android网站开发视频教程
  • 下载 asp网站用脚手架如何搭建项目做网站
  • 装企工长网站开发.wordpress安装
  • 住房和城乡建设部网站登录网站做信息流
  • 文汇网站建设广州网站建设索王道下拉
  • ppt免费下载的网站有哪些市场营销推广策划方案
  • 各大房产网站网页制作工具有
  • 网站改造设计方案大数据平台建站
  • 济南网站建设哪家强 资海全国高端定制
  • ftp里找到的index文件查看网站建设中wordpress上传图片插件
  • 淘宝客怎么样做网站优设计网站建设
  • 有网站了怎么设计网页聊城企业门户网站建设
  • 北京通网站建设价格如何开网店0基础教程
  • 为什么做网站备案的人态度差什么网站可以做ppt
  • dw做的网站如何上传云服务器网站为何改版
  • 商城网站建设是 什么网站怎么做图片动态图片不显示
  • 网站制作谁家好西安网站制作培训