org.subethamail.smtp.client
Class SmartClient

java.lang.Object
  extended by org.subethamail.smtp.client.SMTPClient
      extended by org.subethamail.smtp.client.SmartClient

public class SmartClient
extends SMTPClient

A somewhat smarter abstraction of an SMTP client which doesn't require knowing anything about the nitty gritty of SMTP.

Author:
Jeff Schnitzer

Nested Class Summary
 
Nested classes/interfaces inherited from class org.subethamail.smtp.client.SMTPClient
SMTPClient.Response
 
Constructor Summary
SmartClient(java.lang.String host, int port, java.net.SocketAddress bindpoint, java.lang.String myHost)
           
SmartClient(java.lang.String host, int port, java.lang.String myHost)
           
 
Method Summary
 void dataEnd()
          Last step after writing data
 void dataStart()
          Prelude to writing data
 void dataWrite(byte[] data, int numBytes)
          Actually write some data
 void from(java.lang.String from)
           
 int getRecipientCount()
           
 void quit()
          Quit and close down the connection.
 boolean sentFrom()
           
 boolean sentTo()
           
 void to(java.lang.String to)
           
 
Methods inherited from class org.subethamail.smtp.client.SMTPClient
close, getHostPort, receive, receiveAndCheck, send, sendAndCheck, sendReceive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmartClient

public SmartClient(java.lang.String host,
                   int port,
                   java.lang.String myHost)
            throws java.net.UnknownHostException,
                   java.io.IOException,
                   SMTPException
Throws:
java.net.UnknownHostException - if problem looking up hostname
SMTPException - if problem reported by the server
java.io.IOException - if problem communicating with host

SmartClient

public SmartClient(java.lang.String host,
                   int port,
                   java.net.SocketAddress bindpoint,
                   java.lang.String myHost)
            throws java.net.UnknownHostException,
                   java.io.IOException,
                   SMTPException
Throws:
java.net.UnknownHostException - if problem looking up hostname
SMTPException - if problem reported by the server
java.io.IOException - if problem communicating with host
Method Detail

from

public void from(java.lang.String from)
          throws java.io.IOException,
                 SMTPException
Throws:
java.io.IOException
SMTPException

to

public void to(java.lang.String to)
        throws java.io.IOException,
               SMTPException
Throws:
java.io.IOException
SMTPException

dataStart

public void dataStart()
               throws java.io.IOException,
                      SMTPException
Prelude to writing data

Throws:
java.io.IOException
SMTPException

dataWrite

public void dataWrite(byte[] data,
                      int numBytes)
               throws java.io.IOException
Actually write some data

Throws:
java.io.IOException

dataEnd

public void dataEnd()
             throws java.io.IOException,
                    SMTPException
Last step after writing data

Throws:
java.io.IOException
SMTPException

quit

public void quit()
Quit and close down the connection. Ignore any errors.


sentFrom

public boolean sentFrom()
Returns:
true if we have already specified from()

sentTo

public boolean sentTo()
Returns:
true if we have already specified to()

getRecipientCount

public int getRecipientCount()
Returns:
the number of recipients that have been accepted by the server


Copyright © 2006-2011. All Rights Reserved.