一起学习
public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse
httpservletresponse)
throws ServletException, IOException
{
PrintWriter printwriter = null;
Hashtable hashtable = null;
Hashtable hashtable1 = null;
String s = httpservletrequest.getQueryString();
httpservletresponse.setContentType("text/vnd.wap.wml");
printwriter = httpservletresponse.getWriter();
printwriter.println("");
if(s == null)
{
printwriter.println("");
printwriter.println("");
printwriter.println("
");
printwriter.println("WapMailer: Can't read template file");
printwriter.println("
");
printwriter.println("");
printwriter.println("");
printwriter.flush();
printwriter.close();
return;
}
hashtable1 = getTemplate(s);
if(hashtable1.size() == 0)
{
printwriter.println("");
printwriter.println("");
printwriter.println("
");
printwriter.println("WapMailer: Can't read template file");
printwriter.println("
");
printwriter.println("");
printwriter.println("");
printwriter.flush();
printwriter.close();
return;
}
if(hashtable1.get("PORT") == null || hashtable1.get("FROM") == null ||
hashtable1.get("TO") == null || hashtable1.get("MAILHOST") == null ||
hashtable1.get("DOMAIN") == null)
{
printwriter.println("");
printwriter.println("");
printwriter.println("
");
printwriter.println("WapMailer: Can't send mail. Check template file");
printwriter.println("
");
printwriter.println("");
printwriter.println("");
printwriter.flush();
printwriter.close();
return;
}
hashtable = new Hashtable();
String s1;
for(Enumeration enumeration = httpservletrequest.getParameterNames();
enumeration.hasMoreElements(); hashtable.put(s1.toUpperCase(),
decodeString(httpservletrequest.getParameter(s1),
httpservletrequest.getCharacterEncoding(), (String)hashtable1.get("ENCODING"))))
s1 = (String)enumeration.nextElement();
boolean flag = letterToNet(hashtable, hashtable1);
printwriter.println("");
printwriter.println("");
printwriter.println("
");
if(flag)
printwriter.println("WapMailer: your message has been send");
else
printwriter.println("WapMailer: Can't send mail");
printwriter.println("
");
printwriter.println("");
printwriter.println("");
printwriter.flush();
printwriter.close();
}
相关连接:
构建WAP邮件发送服务器 (一)
构建WAP邮件发送服务器 (二)
构建WAP邮件发送服务器 (三)
构建WAP邮件发送服务器 (四)
构建WAP邮件发送服务器 (五)
构建WAP邮件发送服务器 (六)
下载本文示例代码
构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)构建WAP邮件发送服务器 (四)
阅读(201) | 评论(0) | 转发(0) |