📄 mailsend.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" %>
<%@ include file="check.jsp" %>
<%@ page import="java.util.Date" %>
<%
Calendar now = Calendar.getInstance();
String sj2 = now.get(Calendar.YEAR)+"-"+(now.get(Calendar.MONTH)+1)+"-"+now.get(Calendar.DAY_OF_MONTH)+" "+now.get(Calendar.HOUR_OF_DAY)+":"+now.get(Calendar.MINUTE)+":"+now.get(Calendar.SECOND);
String sj = session.getAttribute("Uid")+"_"+now.get(Calendar.YEAR)+"-"+(now.get(Calendar.MONTH)+1)+"-"+now.get(Calendar.DAY_OF_MONTH)+" "+now.get(Calendar.HOUR_OF_DAY)+":"+now.get(Calendar.MINUTE)+":"+now.get(Calendar.SECOND);
String path = request.getRealPath("attached");
myUpload.setSavePath(path);
myUpload.setNewname(sj);
myUpload.doUpload(request,response);
String towho = myUpload.getFieldValue("towho");
String stowho = myUpload.getFieldValue("stowho");
String bywho = myUpload.getFieldValue("bywho");
String sbywho = myUpload.getFieldValue("sbywho");
String subject = myUpload.getFieldValue("subject");
String message = myUpload.getFieldValue("message");
// String kind = myUpload.getFieldValue("kind");
String fname = "no attached!";
String url = "";
if(myUpload.isUpload()){
fname = sj+"."+myUpload.getFileext();
url= "attached/"+fname;;
}
String sql;
boolean t = true;
// out.println("temp="+temp+" towho="+towho+" stowho="+stowho+" title="+title+" message="+message+" filename="+fname);
sql="select * from myuser where ID="+towho;
sqlbean.executeQuery(sql);
if( sqlbean.getTotalNum()<1) {
out.println(sqlbean.showMsg("javascript:history.back()","您所输入的收信人不存在!","系统提示"));
t = false;
}
if(t){
sql = "insert into allmail (towho,stowho,userid,username,title,message,url,time,status,isread) values('"
+towho+"','"
+sqlbean.to_8859_1(stowho)+"','"
+session.getAttribute("Uid")+"','"
+sqlbean.to_8859_1(session.getAttribute("Uname").toString())+"','"
+sqlbean.to_8859_1(subject)+"','"
+sqlbean.to_8859_1(message)+"','"
+sqlbean.to_8859_1(url)+"','"+sj2+"',1,1)";
//为发件箱准备
//out.println(sql);
sqlbean.executeUpdate(sql);
sql = "insert into allmail (towho,stowho,userid,username,title,message,url,time,status,isread) values('"
+session.getAttribute("Uid")+"','"
+sqlbean.to_8859_1(session.getAttribute("Uname").toString())+"','"
+towho+"','"
+sqlbean.to_8859_1(stowho)+"','"
+sqlbean.to_8859_1(subject)+"','"
+sqlbean.to_8859_1(message)+"','"
+sqlbean.to_8859_1(url)+"','"
+sj2+"',"
+"0,0)";//为收件箱做准备
//out.println(sql);
sqlbean.executeUpdate(sql);
if(bywho!=null && sbywho!=null){
sql = "insert into allmail (towho,stowho,userid,username,title,message,url,time,status,isread) values('"
+bywho+"','"
+sqlbean.to_8859_1(sbywho)+"','"
+session.getAttribute("Uid")+"','"
+sqlbean.to_8859_1(session.getAttribute("Uname").toString())+"','"
+sqlbean.to_8859_1(subject)+"','"
+sqlbean.to_8859_1(message)+"','"
+sqlbean.to_8859_1(url)+"','"+sj2+"',1,1)";
//为发件箱准备
//out.println(sql);
sqlbean.executeUpdate(sql);
sql = "insert into allmail (towho,stowho,userid,username,title,message,url,time,status,isread) values('"
+session.getAttribute("Uid")+"','"
+sqlbean.to_8859_1(session.getAttribute("Uname").toString())+"','"
+bywho+"','"
+sqlbean.to_8859_1(sbywho)+"','"
+sqlbean.to_8859_1(subject)+"','"
+sqlbean.to_8859_1(message)+"','"
+sqlbean.to_8859_1(url)+"','"
+sj2+"',"
+"0,0)";//为收件箱做准备
sqlbean.executeUpdate(sql);
}
out.println(sqlbean.showMsg("javascript:window.close()","您的邮件已经成功发送,正在关闭窗口!","系统提示"));
}
sqlbean.close();
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -