public class SmartClient extends SMTPClient
SMTPClient.Response
Constructor and Description |
---|
SmartClient()
Creates an unconnected client.
|
SmartClient(String host,
int port,
SocketAddress bindpoint,
String myHost)
Connects to the specified server and issues the initial HELO command.
|
SmartClient(String host,
int port,
String myHost)
Connects to the specified server and issues the initial HELO command.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(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(String from) |
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(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(String to) |
close, createSocket, getBindpoint, getHostPort, receiveAndCheck, send, sendAndCheck, sendReceive, setBindpoint, toString
public SmartClient()
public SmartClient(String host, int port, String myHost) throws UnknownHostException, IOException, SMTPException
UnknownHostException
- if problem looking up hostnameSMTPException
- if problem reported by the serverIOException
- if problem communicating with hostpublic SmartClient(String host, int port, SocketAddress bindpoint, String myHost) throws UnknownHostException, IOException, SMTPException
UnknownHostException
- if problem looking up hostnameSMTPException
- if problem reported by the serverIOException
- if problem communicating with hostpublic void connect(String host, int port) throws IOException, SMTPException
connect
in class SMTPClient
IOException
- if there is a problem connecting to the portSMTPException
protected SMTPClient.Response receive() throws IOException
receive
in class SMTPClient
IOException
public void from(String from) throws IOException, SMTPException
IOException
SMTPException
public void to(String to) throws IOException, SMTPException
IOException
SMTPException
public void dataStart() throws IOException, SMTPException
IOException
SMTPException
public void dataWrite(byte[] data, int numBytes) throws IOException
IOException
public void dataEnd() throws IOException, SMTPException
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(String myHost)
public String getHeloHost()
Copyright © 2006–2016. All rights reserved.