home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: Java
/
Java.zip
/
smtp101.zip
/
readme.txt
next >
Wrap
Text File
|
1998-02-27
|
4KB
|
114 lines
===============================================================================
Simple Java smtp class
===============================================================================
Written by: Matthias Schorer
333/464 Bangna Place
Sampawuth Road, Prakanong
Bangkok 10260, Thailand
Version: 1.01
Date: 27 Jan 1998
1.) Introduction
------------
When writing my POPNOTE POP3 notifier I searched for a POP3 class
I found it at the website of J. Thomas. Inspiried my the simplicity
of the pop3 class I wanted to write an easy to use smtp class. The
result is what you have just unzipped. Valuable information on the
RFC821 standard of transmitting mail via the smtp protocol can be found
at "http://www.cis.ohio-state.edu/htbin/rfc/rfc821.html". I have included
this document in the docs directory of this smtp class.
2.) Installation
------------
Just unzip the smtp.zip file into a directory which is contained in your
classpath. smtp.zip contains the following directory structure which you
will have to create again, so use the -D switch for WINZIP.
msch+ class directory for all my classes
|
+--smtp+ contains the smtp class
|
+--docs contains the documents
3.) Use
---
This is an example on how to use the smtp class.
import msch.smtp.* ;
public class Test
{
smtp smtpClient = new smtp() ;
smtpStatus status ;
public Test()
{
smtpClient.setReplyTo("matze@127.0.0.1") ;
smtpClient.setXMailer("my mailer") ;
smtpClient.setDebugOn(true) ;
status = smtpClient.connect("127.0.0.1") ;
if ( status.OK() ){
status = smtpClient.startCommunication() ;
} /* End If */
if ( status.OK() ){
status = smtpClient.sendFromName("matze@127.0.0.1") ;
} /* End If */
if ( status.OK() ){
status = smtpClient.sendToName("Carl") ;
status = smtpClient.sendToName("Fred") ;
status = smtpClient.sendToName("President@whitehouse.gov") ;
status = smtpClient.sendToName("Bill@microsoft.com") ;
} /* End If */
if ( status.OK() ){
status = smtpClient.sendData("Let's see the subject", "This is a test for smtp\r\nand a second line") ;
} /* End If */
status = smtpClient.endCommunication() ;
status = smtpClient.close() ;
System.exit(0) ;
} /* End Method */
public static void main(String args[])
{
new Test() ;
} /* End Method */
} /* End Class */
4.) Questions Bug Reports (what bugs ?)
-----------------------------------
Please send questions and bug reports to "matze@inorbit.com".
5.) Whats new in Version.....
1.01 Mario Corbier (mario@ic2c.com) suggested to send a crlf between the
header and the data, because some mailers seem to need that.
Further on there was a quirk in the demo program which Mario
pointed out. Instead of writing
smtpStatus status = new smtpStatus()
it is enough to write:
smptStatus status;
This will save some microseconds on execution
I have also included the fixed source of the test program