sendmail_do.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:2k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312" %>
  2. <%@ page import="java.util.*"%>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  6. <title>
  7. 发送邮件
  8. </title>
  9. <link href="../common.css" rel="stylesheet" type="text/css">
  10. </head>
  11. <body>
  12. <jsp:useBean id="cfgparser" scope="page" class="fan.util.CFGParser"/>
  13. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil" />
  14. <jsp:useBean id="sendmail" scope="page" class="fan.mail.SendMail" />
  15. <jsp:useBean id="userservice" scope="page" class="com.redmoon.oa.person.UserService"/>
  16. <table width="" border="0" align="center" cellpadding="0" cellspacing="0">
  17.   <tr> 
  18.     <td height="23" valign="bottom" background="../images/tab-b6-top.gif">     <span class="right-title">发 
  19.       邮 件</span></td>
  20.   </tr>
  21.   <tr> 
  22.     <td valign="top" background="../images/tab-b-back.gif">
  23. <table width="98%" border="0" cellspacing="0" cellpadding="0">
  24.   <tr>
  25.           <td> 
  26.             <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  27.               <tr>
  28.                 <td height="176" align="center">
  29. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  30. <%
  31. String priv="read";
  32. if (!privilege.isUserPrivValid(request,priv))
  33. {
  34. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  35. return;
  36. }
  37. %>
  38. <br>
  39. <%
  40. cfgparser.parse("config.xml");
  41. Properties props = cfgparser.getProps();
  42. String mailserver = props.getProperty("mailserver");
  43. String smtp_port = props.getProperty("smtp_port");
  44. String[] r = userservice.getUserEmailNamePwd(privilege.getUser(request));
  45. if (r==null) {
  46. out.println(fchar.p_center("你的请邮箱尚未开通,请向管理员申请!"));
  47. return;
  48. }
  49. String email_name = r[0];
  50. String email_pwd_raw = r[1];
  51. sendmail.initSession(mailserver,smtp_port,email_name,email_pwd_raw);
  52. sendmail.setFrom(email_name+"@"+mailserver);
  53. //sendmail.setmailFooterHTML("<br>--镇江商城!--");
  54. sendmail.getMailInfo(application, request);
  55. if ( sendmail.send())
  56.    out.println("邮件发送成功!");
  57. else
  58. {
  59.    out.println("邮件发送失败,原因是:"+sendmail.geterrinfo());
  60.  }
  61. %>
  62.                   <br>
  63.                 </td>
  64.               </tr>
  65.             </table> </td>
  66.   </tr>
  67. </table>
  68.       </p></td>
  69.   </tr>
  70.   <tr> 
  71.     <td height="9"><img src="../images/tab-b-bot.gif" height="9"></td>
  72.   </tr>
  73. </table>
  74. </body>
  75. </html>