home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / smtp101.zip / readme.txt next >
Text File  |  1998-02-27  |  4KB  |  114 lines

  1. ===============================================================================
  2.                            Simple Java smtp class
  3. ===============================================================================
  4.  
  5. Written by: Matthias Schorer
  6.             333/464 Bangna Place
  7.             Sampawuth Road, Prakanong
  8.             Bangkok 10260, Thailand
  9.  
  10. Version:    1.01
  11. Date:       27 Jan 1998
  12.  
  13.  
  14. 1.) Introduction
  15.     ------------
  16.     When writing my POPNOTE POP3 notifier I searched for a POP3 class
  17.     I found it at the website of J. Thomas. Inspiried my the simplicity
  18.     of the pop3 class I wanted to write an easy to use smtp class. The
  19.     result is what you have just unzipped. Valuable information on the
  20.     RFC821 standard of transmitting mail via the smtp protocol can be found
  21.     at "http://www.cis.ohio-state.edu/htbin/rfc/rfc821.html". I have included
  22.     this document in the docs directory of this smtp class.
  23.  
  24.  
  25. 2.) Installation
  26.     ------------
  27.     Just unzip the smtp.zip file into a directory which is contained in your
  28.     classpath. smtp.zip contains the following directory structure which you
  29.     will have to create again, so use the -D switch for WINZIP.
  30.  
  31.     msch+               class directory for all my classes
  32.         |
  33.         +--smtp+        contains the smtp class
  34.                |
  35.                +--docs  contains the documents
  36.  
  37.  
  38. 3.) Use
  39.     ---
  40.     This is an example on how to use the smtp class.
  41.  
  42.  
  43. import msch.smtp.* ;
  44.  
  45. public class Test
  46. {
  47.        smtp smtpClient = new smtp() ;
  48.        smtpStatus status ;
  49.  
  50.        public  Test()
  51.        {
  52.               smtpClient.setReplyTo("matze@127.0.0.1") ;
  53.               smtpClient.setXMailer("my mailer") ;
  54.  
  55.               smtpClient.setDebugOn(true) ;
  56.  
  57.               status = smtpClient.connect("127.0.0.1") ;
  58.  
  59.               if ( status.OK() ){
  60.                  status = smtpClient.startCommunication() ;
  61.               } /* End If */
  62.  
  63.               if ( status.OK() ){
  64.                   status = smtpClient.sendFromName("matze@127.0.0.1") ;
  65.               } /* End If */
  66.  
  67.               if ( status.OK() ){
  68.                  status = smtpClient.sendToName("Carl") ;
  69.                  status = smtpClient.sendToName("Fred") ;
  70.                  status = smtpClient.sendToName("President@whitehouse.gov") ;
  71.                  status = smtpClient.sendToName("Bill@microsoft.com") ;
  72.               } /* End If */
  73.  
  74.               if ( status.OK() ){
  75.                  status = smtpClient.sendData("Let's see the subject", "This is a test for smtp\r\nand a second line") ;
  76.               } /* End If */
  77.  
  78.               status = smtpClient.endCommunication() ;
  79.  
  80.               status = smtpClient.close() ;
  81.               System.exit(0) ;
  82.        } /* End Method */
  83.  
  84.        public static  void main(String args[])
  85.        {
  86.               new Test() ;
  87.        } /* End Method */
  88.  
  89. } /* End Class */
  90.  
  91.  
  92. 4.) Questions Bug Reports (what bugs ?)
  93.     -----------------------------------
  94.     Please send questions and bug reports to "matze@inorbit.com".
  95.  
  96.  
  97. 5.) Whats new in Version.....
  98.  
  99.     1.01 Mario Corbier (mario@ic2c.com) suggested to send a crlf between the
  100.          header and the data, because some mailers seem to need that.
  101.          Further on there was a quirk in the demo program which Mario
  102.          pointed out. Instead of writing
  103.              smtpStatus status = new smtpStatus()
  104.  
  105.          it is enough to write:
  106.  
  107.              smptStatus status;
  108.  
  109.          This will save some microseconds on execution
  110.  
  111.          I have also included the fixed source of the test program
  112.  
  113.  
  114.