0
자바 메일 API를 사용하여 비밀번호 재설정 링크를 보내도록 href
태그에 동적 값 (액션 클래스)을 갖는 클래스 변수를 추가하는 방법.Struts에서 비밀번호 구현 재설정
내 전송 방법은 다음과 같습니다이 사용
public String sendEmail() {
try {
// System.out.println(getEmail_id());
String link="\"http://localhost:15403/Struts_ApplicationTest/change_Pwd.jsp?=\"";
body="\n<a href="+link+getEmail_id()+">Click here to reset password</a>";
// body= "\n<a href='http://localhost:15403/Struts_ApplicationTest/change_Pwd.jsp>Click here to reset password</a>";
SecurityManager s = new SecurityManager();
System.out.println("assdddssdsd" + s);
Session session = Session.getInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(em_from, em_password);
}
});
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(em_from));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(email_id));
message.setSubject(subject);
message.setDataHandler(new DataHandler(
new ByteArrayDataSource(body, "text/html")));
Transport.send(message);
} catch (Exception e) {
e.printStackTrace();
return "error";
}
return "sent";
}
나는 이메일을 통해 전송 내 링크에서 내 전달 된 변수 이름을 얻을 수 없습니다입니다. 미리 감사드립니다.
문자열이므로 다른 문자열 값처럼 추가하십시오. –
이 질문의 태깅에 대해 두 사람이 토론하고 싶다면 Meta로 가져 가십시오. http://meta.stackoverflow.com/questions/265943/i-need-clarification-on-tagging-questions-with-technologies –