生成新密码后,如何将其发送给用户Mail Id? [英] After generating a new password, how to send it to user Mail Id?
本文介绍了生成新密码后,如何将其发送给用户Mail Id?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
生成新密码的代码:
Code for generating new password:
<%Random r = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 8; ++i) {
char temp = (char) (''a'' + r.nextInt(''Z''- ''A''));
sb.append(temp);
}
String output = sb.toString();
out.println(sb.toString()); %>
发送邮件的Jsp标签:< br $>
Jsp tag to send a mail:
UserName* <input type="text" name="Name" value="" />
<input type="button" value="Proceed" önclick="parent.location=''mailto:abc@gmail.com'';" />
<input type="submit" value="Reset">
推荐答案
上面的标签会给你一个邮件链接。我猜那不是你想要的。
要将带有生成密码的邮件发送给目标用户,您可能需要
来使用Java邮件API。
请参考此处,看看它是否有用。
The above tag would give you a mail to link. I guess thats not you want.
To send a mail with your generated password to an intended user, you might want
to use Java mail api.
Please refer here and see if its helpful.
这篇关于生成新密码后,如何将其发送给用户Mail Id?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文