基于des加密算法的电子邮件的收发软件的开发毕业设计(编辑修改稿)内容摘要:

try { // 捕捉异常 if (rs != null) { // 当 ResultSet 对象的实例 rs 不为空时 ()。 // 关闭 ResultSet 对象 } if (stmt != null) { // 当 Statement 对象的实例 stmt 不为空时 ()。 // 关闭 Statement 对象 } if (conn != null) { // 当 Connection 对象的实例 conn 不为空时 ()。 // 关闭 Connection 对象 } } catch (Exception e) { ()。 // 输出异常信息 } } 主要模块设计 登录首页的设计 首页是用户最先使用的功能。 它 的设计质量关系到给用户的第一感觉,所以它的设计很重要。 首页展示如图 所示。 如何进入首页:  中配置: welefilelist welefile/welefile /welefilelist 陕西理工学院毕业设计 第 11 页 共 29 页  首页登录代码如下: 图 首页 设计图 table width=87% height=162 border=0 cellpadding=0 cellspacing=0 tr td width=20% height=35 align=centerPOP3 服务器: /td td width=80% input name=host type=text id=host size=30 value= title=POP3 服务器 (如: )/td /tr tr td width=20% height=35 align=centersmtp 服务器: /td td width=80% input name=host1 type=text id=host1 size=30 value= title=stmp 服务器 (如: )/td /tr tr td height=35 align=center邮箱名: /td tdinput name=username type=text id=username size=30 value= title=邮箱名 (如: )/td /tr tr td height=35 align=center密 码: /td tdinput name=pwd type=password id=pwd size=30 value= title=邮箱密码 /td /tr tr td height=50 /td tdinput name=Submit type=submit class=btn_bg value=登录 input name=Submit2 type=reset class=btn_bg value=重置 /td /tr /table /div  Action 中主要代码: public void login(HttpServletRequest request,HttpServletResponse response){ String host=(host)。 String host1=(host1)。 陕西理工学院毕业设计 第 12 页 共 29 页 String username=(username)。 String password=(pwd)。 Store store=(host,username,password)。 //建立与邮件接收服务器的连接 if(store!=null){ HttpSession session=()。 (host,host)。 //保存主机名到 session 中 (host1,host1)。 //保存主机名到 session 中 (username,username)。 //保存邮箱名到 session 中 (pwd,password)。 //保存密码到 session 中 try { ().forward(request,response)。 ()。 //关闭与邮件接收服务器的连接 } catch (Exception e) { // TODO Autogenerated catch block ()。 } }else{ //将页面重定向到错误提示页 (error, 您输入的服务器、用户名或是密码错误,登录失败。 )。 try { ().forward(request, response)。 } catch (Exception e) { // TODO Autogenerated catch block ()。 } } //showEmail(request,response,store,false)。 } 发送邮件模块设计  页面展示如图 所示 : 图 邮件发送页面 展示  页面主要代码: table width=100% border=0 align=center cellpadding=0 cellspacing=0 陕西理工学院毕业设计 第 13 页 共 29 页 tr td valign=top background=images/ style=backgroundrepeat:norepeat。 backgroundposition:bottom class=tableBorder table width=96% border=0 align=center cellpadding=0 cellspacing=0 tr td height=23 align=center /td td width=58% height=23 align=center /td td width=22% align=left /td /tr tr td height=28 align=center发件人: /td td colspan=2 align=leftinput name=addresser type=text id=addresser title= 发 件人 value=%=(username).toString()% readonly=yes size=56/td /tr tr td width=20% height=55 align=center收件人: /td td colspan=2 align=left textarea name=addressee cols=54 rows=3 class=wenbenkuang id=addressee title=收件人/textarea /td /tr tr td height=28 align=center主 题: /td td colspan=2 align=leftinput name=title type=text id=title title=邮件主题 size=56/td /tr tr td height=28 align=center附件 1: /td td colspan=2 align=leftinput name=adjunct type=text id=adjunct title= 附件 size=39 readonly=yes input name=Submit3 type=button class=btn_grey value=上传附件 onClick=(39。 ?textName=adjunct39。 ,39。 39。 ,39。 width=350,height=15039。 )。 /td /tr tr td height=28 align=center附件 2: /td td colspan=2 align=leftinput name=adjunct1 type=text id=adjunct1 title=附件 size=39 readonly=yes input name=Submit32 type=button class=btn_grey value=上传附件 1 onClick=(39。 ?textName=adjunct139。 ,39。 39。 ,39。 width=350,height=15039。 )。 /td /tr tr td height=28 align=center内 容: /td td colspan=2 align=lefttextarea name=content cols=50 rows=10/textarea/td /tr tr td height=28 align=center /td 陕西理工学院毕业设计 第 14 页 共 29 页 td colspan=2 align=leftinput name=Submit type=submit class=btn_grey value=发送 input name=Submit2 type=reset class=btn_grey value=重置 /td /tr /table/td /tr /table  Action 中主要代码: public int sendMail(SendM ailForm s) { int ret = 0。 String host = ()。 //POP3 服务器 String from = ()。 //发件人 String to = ()。 //收件人 String subject = ()。 //主题 String content = ()。 //邮件内容 String password = ()。 //发件人密码 String path = ()。 //附件 1 String path1=()。 //附件 2 try { String mailserver =smtp.+((39。 @39。 )+1,())。 //在 Inter 上发送邮件时 的代 码 String mailserver =host。 //在局域网内发送邮件时的代码 Properties prop = new Properties()。 //实例化 Properties 类 (, mailserver)。 //指定采用 SMTP 协议的邮件发送服务器的主机名 (, true)。 //指定 SMTP 服务器需要验证 Session sess = (prop)。 //根据已经配置的属性创建 Session 实例 (true)。 //设置调试标志 MimeMessage message = new MimeMessage(sess)。 //实例化 MimeMessage 类 (new InterAddress(from))。 // 给消息对象设置发件人 //设置收件人 String toArr[]=(,)。 //将以逗号分隔的收件人字符串转换为数 组 InterAddress[] to_mail=new InterAddress[]。 for(int i=0。 i。 i++){ to_mail[i]=new InterAddress(toArr[i])。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。