做到一个邮箱验证需要发送超链接,其实很简单:
/** * 发送邮件认证 * @return */ public String sendValidate(){ if(validateType.equals("1")){//邮箱 url="identifyPerson.action"; String email = personBackMatter.getEmail(); String validateCode = MD5.md5(email); personBackMatter = (PersonBackMatter) ((BaseTransaction)Platform.getInstance().getBean("baseTransaction")).get(PersonBackMatter.class, this.getUser().getId()); personBackMatter.setValidateCode(validateCode); personBackMatter.setValidateTime(currentTime); ((BaseTransaction)Platform.getInstance().getBean("baseTransaction")).update(personBackMatter); ///邮件的内容 StringBuffer sf=new StringBuffer(); sf.append("<a href=/"http://192.168.0.84:8088/ompxm/activateEmail.action?email="); sf.append(email); sf.append("&validateCode="); sf.append(validateCode); sf.append("/">"); sf.append(" <FONT face=/"MS UI Gothic/" size=/"3/"><b>点击这里</b></FONT>"); sf.append("</a>"); sf.append("激活账号,24小时生效,否则重新验证,请尽快激活!<br>"); //发送邮件 EmailService.sendEmail("厦门服务平台邮箱验证",email, "", "", sf.toString()); System.out.println("发送邮件"); msg="邮件发送成功,请登陆"+email+"邮箱进行验证"; } return "success"; }
在里用a标签就OK。
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/7785.html