📄 sendmail.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" language="java" %><%@ page import="ten.*,simpleforum.util.*"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title>发送邮件测试</title> <meta name="copyright" content="邮件发送测试. All rights reserved."> <meta name="Keywords" content="jsp,servlet,mail"> <meta name="Description" content="发送邮件测试"> <meta http-equiv="content-type" content="text/html; charset=gb2312"></head><body><% String host = ParamUtil.getParameter(request,"host"); String user = ParamUtil.getParameter(request,"user"); String password = ParamUtil.getParameter(request,"password"); String subject = ParamUtil.getParameter(request,"subject"); String to = ParamUtil.getParameter(request,"to"); String from = ParamUtil.getParameter(request,"from"); String bodyashtml = ParamUtil.getParameter(request,"bodyashtml"); String attachfile = ParamUtil.getParameter(request,"attachfile"); out.println("<br>"+host); out.println("<br>"+user); //out.println("<br>"+password); out.println("<br>"+subject); out.println("<br>"+to); out.println("<br>"+from); out.println("<br>"+bodyashtml); out.println("<br>"+attachfile); try { SendMail send = new SendMail(); send.setHost(host); send.setUser(user); send.setPass(password); send.setSubject(subject); send.setTo(to); send.setFrom(from); send.setBodyAsHTML(bodyashtml); send.addAttachFromFile(attachfile,"aa.txt"); send.send(); out.println("<br>邮件发送成功!!!"); } catch (Exception e) { out.println("<br>"+e.getMessage()); out.println("<br>邮件发送失败!!!"); }%></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -