当前位置:沸点梦工场 > WAP网页设计 > Jsp wap开发教程 > 浏览文章

构建WAP邮件发送服务器

互联网 2007年06月04日 【字体:

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();

}

上一页  [1] [2] [3] [4] [5] [6]  下一页


上一页      下一页
本文共 6 页,第  [1]  [2]  [3]  [4]  [5]  [6]  页