public class SmartClient extends SMTPClient
SMTPClient.Response
Constructor and Description |
---|
SmartClient()
Creates an unconnected client.
|
SmartClient(java.lang.String host,
int port,
java.net.SocketAddress bindpoint,
java.lang.String myHost)
Connects to the specified server and issues the initial HELO command.
|
SmartClient(java.lang.String host,
int port,
java.lang.String myHost)
Connects to the specified server and issues the initial HELO command.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(java.lang.String host,
int port)
Connects to the specified server and issues the initial HELO command.
|
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) |
java.lang.String |
getHeloHost()
Returns the HELO name of this system.
|
int |
getRecipientCount() |
void |
quit()
Quit and close down the connection.
|
protected SMTPClient.Response |
receive()
Returns the server response.
|
boolean |
sentFrom() |
boolean |
sentTo() |
void |
setHeloHost(java.lang.String myHost)
Sets the domain name or address literal of this system, which name will
be sent to the server in the parameter of the HELO and EHLO commands.
|
void |
to(java.lang.String to) |
close, createSocket, getBindpoint, getHostPort, receiveAndCheck, send, sendAndCheck, sendReceive, setBindpoint, toString
public SmartClient()
public SmartClient(java.lang.String host, int port, java.lang.String myHost) throws java.net.UnknownHostException, java.io.IOException, SMTPException
java.net.UnknownHostException
- if problem looking up hostnameSMTPException
- if problem reported by the serverjava.io.IOException
- if problem communicating with hostpublic SmartClient(java.lang.String host, int port, java.net.SocketAddress bindpoint, java.lang.String myHost) throws java.net.UnknownHostException, java.io.IOException, SMTPException
java.net.UnknownHostException
- if problem looking up hostnameSMTPException
- if problem reported by the serverjava.io.IOException
- if problem communicating with hostpublic void connect(java.lang.String host, int port) throws java.io.IOException, SMTPException
connect
in class SMTPClient
java.io.IOException
- if there is a problem connecting to the portSMTPException
protected SMTPClient.Response receive() throws java.io.IOException
receive
in class SMTPClient
java.io.IOException
public void from(java.lang.String from) throws java.io.IOException, SMTPException
java.io.IOException
SMTPException
public void to(java.lang.String to) throws java.io.IOException, SMTPException
java.io.IOException
SMTPException
public void dataStart() throws java.io.IOException, SMTPException
java.io.IOException
SMTPException
public void dataWrite(byte[] data, int numBytes) throws java.io.IOException
java.io.IOException
public void dataEnd() throws java.io.IOException, SMTPException
java.io.IOException
SMTPException
public void quit()
It still closes the connection, but it does not send the QUIT command if a 421 Service closing transmission channel is received previously. In these cases QUIT would fail anyway.
public boolean sentFrom()
public boolean sentTo()
public int getRecipientCount()
public void setHeloHost(java.lang.String myHost)
public java.lang.String getHeloHost()
Copyright © 2006-2013. All Rights Reserved.