package sendmail;
import javax.mail.MessagingException;
import javax.servlet.http.HttpSession;
public class Service {
private final static String WY163="163";
public String getEmail(String email,HttpSession session){
//邮箱验证和绑定
//String emailPath=validationEmail(email);
System.out.println("emailPath:"+email);
session.setAttribute("emailPath", email);
//设置发送内容
/*http://localhost:8088/InProject/listUI.do?email=*/
String chaining="http://localhost:8085/sendmail.do?email="+email;
//设置发送人
String fromEmail="1102381496@qq.com";
//设置QQ号
String qq="1102381496";
//设置邮件标题
String title="你好,欢迎注册本网站!";
//设置邮件内容
String core="欢迎注册本网站,链接10分钟有效!"+chaining;
String[] connent=new String[]{title,core,qq};
//发送邮件
try {
boolean b=Util.sendEmail(fromEmail, email, connent);
if(!b){
throw new RuntimeException("发送邮件失败");
}
} catch (MessagingException e) {
throw new RuntimeException("发送邮件失败");
}
return null;
}
// public String validationEmail(String email){
// if((email==null)||(email=="")){
// throw new RuntimeException("邮箱不能为空!");
// }
//
// String domianName=email.substring(email.indexOf("@")+1,email.indexOf("."));
// String emailPath = null;
// System.out.println("domainName"+domianName);
// if(domianName.equals(WY163)){
// emailPath=WY163;
// }
//
// return emailPath;
// }
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。