package org.bromon.mail;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TestServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
SenderWithSMTPVer sm = new SenderWithSMTPVer();
sm.setHost("smtp.163.com");// 指定要使用的邮件服务器
sm.setAccount("[email protected]", "mengaijing");// 指定帐号和密码
sm.send("[email protected]", request.getParameter("email"), "沱沱工社注册",
"亲爱的用户:"+
"欢迎你使用搜狐微博,点击以下链接完成注册:"+
"http://localhost:8080/email/success.jsp"+
"如果你的邮箱不支持链接点击,请将以上链接地址拷贝到你的浏览器地址栏中。"+
"此邮件由系统自动产生,请勿回复。(该链接仅在7日内点击有效,如果超过7日未点击确认,请你登录搜狐微博,并申请重发激活邮件)。"+
"如有疑问,请拨打客服电话:010-58511234");
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.print(" This is ");
out.print(this.getClass());
out.println(", using the POST method");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
如果你用myEclipse进行开发的话,运行时可能会出现以下的错误: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream 原因是jar包版本不统一,解决方法如下: 删除Java EE 5 Libraries/javaee.jar/mail里的包有东西. 具体方法如下: 用rar打开X:/Program Files/MyEclipse 6.0/myeclipse/eclipse/plugins/com.genuitec.eclipse.j2eedt.core_6.0.1.zmyeclipse601200710/data/libraryset/EE_5/javaee.jar
资源详情
资源评论
资源推荐
收起资源包目录
































共 16 条
- 1






























甜瓜先生
- 粉丝: 0
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- Python数据可视化中的Matplotlib进阶技巧.doc
- Python爬虫中的代理池构建与维护方法.doc
- Python爬虫从入门到突破反爬策略全流程.doc
- Python数据清洗的自动化方法与工具.doc
- Python正则表达式的高级用法与实例.doc
- Python异步编程与协程的进阶实践.doc
- Redis持久化机制的原理与数据恢复方法.doc
- Redis在高并发秒杀系统中的应用优化.doc
- TensorFlow与PyTorch在图像识别中的对比.doc
- Vue与React在大型项目中的架构对比分析.doc
- WebAssembly在前端游戏开发中的应用.doc
- WebAssembly在复杂计算中的应用探索.doc
- Web安全防护的多层架构与实践方法.doc
- Web性能优化的关键指标与监控方法.doc
- Web安全漏洞的自动化检测与修复方案.doc
- 大规模数据库备份与恢复的自动化实现.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论2