cfnagement-simple.rar

  • cscur
    了解作者
  • Others
    开发工具
  • 20KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2017-03-24 19:08
    上传日期
一个简单的成绩管理系统,可以学习的,真心不错
cfnagement-simple.rar
  • gblogo.gif
    1.9KB
  • smtpSend.class
    4KB
  • tFrame.class
    1.6KB
  • logoPanel.class
    1.3KB
  • imageLoader.class
    2.1KB
  • gb2.class
    4.9KB
  • componentQueue.class
    722B
  • qElement.class
    417B
  • circQueue.java
    4.6KB
  • tButton.class
    647B
  • tFrame.java
    4.8KB
  • gb2.java
    19.2KB
  • tButton.java
    1.7KB
  • componentQueue.java
    2.1KB
  • gbFrame.class
    4.2KB
  • circQueue.class
    1.3KB
  • ICONS155.GIF
    541B
  • test.html
    310B
内容介绍
/* gb2.java * * Version 2.0 * Copyright(C) 1996 by Bill Giel * * E-mail: rvdi@usa.nai.net * WWW: http://www.nai.net/~rvdi/home.htm * *************************************************************************** * Abstract * -------- * A simple SMTP mail sender with a guest book interface. * * Version 2.0a adds preferredSize and minimumSize Methods to logoPanel class * *************************************************************************** * THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. ***************************************************************************/ /* Documentation addendum from Version 1 * * NOTE: TO RECEIVE GUEST BOOK ENTRIES, YOU MUST SPECIFY YOUR E-MAIL * ADDRESS AS THE 'RECEIVER' PARAMETER IN THE APPLETS HTML TAG. * * YOUR LOCAL HOST MUST SUPPORT SMTP MESSAGES ON PORT 25 * * * ADDENDUM TO DOCUMENTATION (7 Feb 1996) - Some of you have been * unable to get your guestbook applets to work on your own home * pages, while others have been successful. * * If you have a chance to study the code of the mailMessage method * of the 'send' class, you'll see that guestbook first establishes * a socket with the 'mailhost' at port 25, in accordance with * TCP/SMTP specs (see RFC 821). * * Then, guestbook waits for the 220 'service ready' message transmission * over the socket. After successfully receiving 220, it then obtains the * 'helohost' domain name from the server and transmits the HELO <domain> * command over the socket. If accepted, the receiver-SMTP returns a 250 * (OK) reply. * * Following that , guestbook sends MAIL FROM: <sender>, then RECPT TO: * <receiver>, expecting 250 replies after each. Note that in guestbook, * the sender and receiver addresses are the same. * * It then sends the DATA command, and expects 354 intermediate reply from * the SMTP server. All that follows DATA is the standard text message in * the format defined in RFC 822, with a standard 'Subject:' field, followed * by a blank line. What follows the blank line is the actual text (your guest's * optional name, optional email address and comments or suggestions.) * * After the message is transmitted, guestbook transmits a single '\r\n . \r\n', * signifying end of message, waits for a 250 (OK) reply, then transmits a final * QUIT command, and anticipates receipt of 221, indicating the server is closing * the SMTP channel. * * The mailMessage method then closes the socket before returning true, only if * all of the above were successful. mailMessage returns false on any errors, or * if the receiver parameter is null. * * Guestbook should work just fine on your homepage, so long as your www host * supports the above SMTP protocol. You may otherwise have to experiment * to get guestbook to work with custom settings. That could actually be * fun... but since guestbook works as-is on my www server, I have no need * to mess with it :-( * * Please let me know if you manage to get guestbook working by revising it * for conditions other than those it is designed for. * * I hope this additional information is helpful. * ---------------------------------------------------------------------------- * smtpSend class built up from code demonstated in sendmail.java * by Godmar Back, University of Utah, Computer Systems Lab, 1996 * (a simple applet that sends you mail when your page is accessed) * ---------------------------------------------------------------------------- */ import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; import java.util.*; class smtpSend { static final short PORT = 25; String lastline; DataInputStream in; PrintStream p; String mailhost, receiver, sender; TextArea scroller = null; Socket socket = null; smtpSend( String mailhost, String receiver) { this.mailhost = mailhost; this.receiver = receiver; this.sender = receiver; } public void setScroller(TextArea scroller) { this.scroller = scroller; } void expect(String expected, String errorMsg) throws Exception { lastline = in.readLine(); if (!lastline.startsWith(expected)) throw new Exception("Error: " + errorMsg + " (Expected " + expected + ")"); while (lastline.startsWith(expected + "-")) lastline = in.readLine(); } private void scrollOK() { scroller.appendText("OK"); } private void openSocket() throws Exception { display("Connecting to " + mailhost + "..."); try{ socket = new Socket(mailhost, PORT); } catch (Exception e){ throw new Exception("Socket Error: Can't connect!"); } scrollOK(); } private void openInputStream() throws Exception { display("Opening input stream" + "..."); try{ in = new DataInputStream(socket.getInputStream()); }catch (Exception e){ throw new Exception("Connection Error: Cannot open for input."); } scrollOK(); } private PrintStream openOutputStream() throws Exception { display("Opening output stream" + "..."); try{ p = new PrintStream(socket.getOutputStream()); }catch (Exception e){ throw new Exception("Connection Error: Cannot open for output."); } scrollOK(); return p; } private String getHeloHost() throws Exception { String helohost; display("Getting Local Host Name" + "..."); try{ helohost = InetAddress.getLocalHost().toString(); }catch (Exception e){ throw new Exception("Network Error: Unknown Local Host."); } scrollOK(); display("Local Host: " + helohost + "\r\n"); return helohost; } private void display(String string) { if (null != scroller) scroller.appendText("\r\n" + string); System.out.println(string); } private void sendData(String subject, String message) throws Exception { try{ String helohost = getHeloHost(); p.print("HELO " + helohost + "\r\n"); expect("250", "HELO"); int pos; String hello = "Hello "; if ((pos = lastline.indexOf(hello)) != -1) { helohost = lastline.substring(pos + hello.length()); helohost = helohost.substring(0, helohost.indexOf(' ')); } p.print("MAIL FROM: " + sender + "\r\n"); expect("250", "MAIL FROM:"); p.print("RCPT TO: " + receiver + "\r\n"); expect("250", "RCPT TO:"); p.print("DATA\r\n"); expect("354", "DATA"); p.print("Subject: " + subject); p.print(" (" + helohost + ")"); p.print("\r\n\r\n"); DataInputStream is = new DataInputStream(new StringBufferInputStream(message)); while (is.available() > 0) { String ln = is.readLine(); if (ln.equals(".")) ln = ".."; p.println(ln); } p.print(new Date().toGMTString()); p.print("\r\n.\r\n"); expect("250", "end of data"); p.print("QUIT\r\n"); expect("221", "QUIT"); }catch(Exception e){ throw e; } } public void mailMessage(String subject,String message) throws Exception { if(null==receiver)throw new Exception("Parameter Error: No RECEIVER"); try{ openSocket(); openOutputStream(); openInputStream(); expect("220", "No greeting"); display("Sending message via SMTP...
评论
    相关推荐
    • 数据库课程设计
      一个数据库课程设计,access管理工具实现,用的是窗体!
    • 数据库课程设计
      数据库课程设计十分完整有需要的请下载啊谢谢
    • 数据库课程设计
      广东工业大学数据库课程设计,可视化界面连接数据库,delphi7
    • 数据库课程设计
      数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述 数据库课程设计实验及其描述
    • 数据库课程设计
      数据库课程设计》由周爱武、汪海威、肖云编著,遵循数据库课程设计的具体要求,独立于具体的数据库教材,从实际应用系统的需求着手,引导读者逐步完成数据库设计全过程,重点讲解数据库系统的需求分析、概念设计、...
    • 数据库课程设计
      数据库课程设计人事管理系统 数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计人事管理系统数据库课程设计...
    • 数据库课程设计
      数据库课程设计,基于visual basic自助银行管理系统,界面很清爽,实用。同学都说好,所以就上传了!!!
    • 数据库课程设计
      数据库课程设计 里面有详细的文档资料 包含数据库一切的图 以及生成的数据库表文件 期末得分为优秀
    • 数据库课程设计
      可以作为数据库课程设计,也可以作为Java的课程设计,内容全面。本资源转载的,非本人原创。用于交流学习,特此申明!
    • 数据库课程设计
      数据库课程设计蓝天大学学生管理系统 2.商店信息管理系统 3.实验室机房收费管理系统 4.图书馆资料检索系统 5.企业库存管理系统 6.仓库管理系统 7.工程项目管理系统 8.教材管理系统 9.企业人事管理系统 10.企业财务...