All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.ibm.net.SMTPClient

java.lang.Object
   |
   +----COM.ibm.net.InetProtocolClient
           |
           +----COM.ibm.net.SMTPClient

public class SMTPClient
extends InetProtocolClient
Implements a Simple Mail Transfer Protocol (RFC 821) client.

Internally supported SMTP commands:
HELO MAIL RCPT DATA SEND QUIT

Unsupported commands:
RSET SOML SAML VRFY EXPN HELP NOOP TURN

 Copyright (c) Taligent, Inc.  1996 - 1997.
 Copyright (c) IBM Corporation 1996 - 1997.
 All Rights Reserved.
 


Variable Index

 o sender
Sender email address.

Constructor Index

 o SMTPClient()
Empty default constructor.
 o SMTPClient(String, int, String)
Constructs a mail session with a SMTP server.
 o SMTPClient(String, String)
Constructs a mail session with a SMTP server.

Method Index

 o mailSent()
Terminate sending mail.
 o sendMail(String)
Send mail to a single recipient.
 o sendMail(String[])
Send mail to a single recipient.

Variables

 o sender
 public String sender
Sender email address.

Constructors

 o SMTPClient
 public SMTPClient()
Empty default constructor.

 o SMTPClient
 public SMTPClient(String mailServ,
                   String from)
Constructs a mail session with a SMTP server. SMTPClient will use port 25 by default.

Parameters:
mailServ - Name or IP address of the mail server
from - Email address of the sender
 o SMTPClient
 public SMTPClient(String mailServ,
                   int port,
                   String from)
Constructs a mail session with a SMTP server.

Parameters:
mailServ - Name or IP address of the mail server
from - Email address of the sender
port - Port number of the mail server

Methods

 o sendMail
 public PrintWriter sendMail(String recipient) throws IOException
Send mail to a single recipient. Use the returned PrintWriter to write the mail header and body. If any line in the body begins with a period ('.'), add an extra period before writing the remainder of the line. This is required for SMTP conformance. You must call mailSent() to indicate that the message has been written. Do not close the PrintWriter stream.

Parameters:
recipient - Email address of the recipient
Throws: IOException
Could not initiate sending mail
See Also:
mailSent, PrintWriter
 o sendMail
 public PrintWriter sendMail(String recipients[]) throws IOException
Send mail to a single recipient. Use the returned PrintWriter to write the mail header and body. If any line in the body begins with a period ('.'), add an extra period before writing the remainder of the line. This is required for SMTP conformance. You must call mailSent() to indicate that the message has been written. Do not close the PrintWriter stream.

Parameters:
recipients - Array of email addresses
Throws: IOException
Could not initiate sending mail
See Also:
mailSent, PrintWriter
 o mailSent
 public void mailSent() throws IOException
Terminate sending mail. Must be called after calling sendMail().

Throws: IOException
Could not terminate mail
See Also:
sendMail, sendMail

All Packages  Class Hierarchy  This Package  Previous  Next  Index