import javax.mail.Transport; import javax.mail.internet.MimeMessage; import javax.mail.Authenticator; import javax.mail.Message.RecipientType; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.internet.InternetAddress;
/** * 发送邮件验证码 * wan * @param * @return * @throws Exception */ @RequestMapping(value = "/sendEmailVerifyCode.html") @ResponseBody public ResultVO sendEmailVerifyCode(@ModelAttribute SmsmessageVO smsMessageVo) throws Exception { ResultVO resultVO = new ResultVO(); try { String code = RandomUtils.CreateRandomVcode(6); smsMessageVo.setCode(code); smsMessageVo.setSendtime(new Date()); //smsMessageVo.setSmstype(106); smsmessageService.addRecord(smsMessageVo); Properties props = new Properties(); // 表示SMTP发送邮件,需要进行身份验证