|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.subethamail.smtp.client.SMTPClient
public class SMTPClient
A very low level abstraction of the STMP stream which knows how to handle the raw protocol for lines, whitespace, etc.
| Nested Class Summary | |
|---|---|
static class |
SMTPClient.Response
Result of an SMTP exchange. |
| Constructor Summary | |
|---|---|
SMTPClient(java.lang.String host,
int port)
Establishes a connection to host and port and negotiate the initial EHLO exchange. |
|
SMTPClient(java.lang.String host,
int port,
java.net.SocketAddress bindpoint)
Establishes a connection to host and port from the specified local socket address and negotiate the initial EHLO exchange. |
|
| Method Summary | |
|---|---|
void |
close()
Logs but otherwise ignores errors |
java.lang.String |
getHostPort()
|
protected SMTPClient.Response |
receive()
Note that the response text comes back without trailing newlines. |
void |
receiveAndCheck()
If response is not success, throw an exception |
protected void |
send(java.lang.String msg)
Sends a message to the server, ie "HELO foo.example.com". |
void |
sendAndCheck(java.lang.String msg)
If response is not success, throw an exception |
SMTPClient.Response |
sendReceive(java.lang.String msg)
Sends a message to the server, ie "HELO foo.example.com". |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SMTPClient(java.lang.String host,
int port)
throws java.net.UnknownHostException,
java.io.IOException
java.net.UnknownHostException - if the hostname cannot be resolved
java.io.IOException - if there is a problem connecting to the port
public SMTPClient(java.lang.String host,
int port,
java.net.SocketAddress bindpoint)
throws java.net.UnknownHostException,
java.io.IOException
bindpoint - the local socket address. If null, the system will pick
up an ephemeral port and a valid local address.
java.net.UnknownHostException - if the hostname cannot be resolved
java.io.IOException - if there is a problem connecting to the port| Method Detail |
|---|
public java.lang.String getHostPort()
protected void send(java.lang.String msg)
throws java.io.IOException
msg - should not have any newlines
java.io.IOException
protected SMTPClient.Response receive()
throws java.io.IOException
java.io.IOException
public SMTPClient.Response sendReceive(java.lang.String msg)
throws java.io.IOException
msg - should not have any newlines
java.io.IOException
public void receiveAndCheck()
throws java.io.IOException,
SMTPException
java.io.IOException
SMTPException
public void sendAndCheck(java.lang.String msg)
throws java.io.IOException,
SMTPException
java.io.IOException
SMTPExceptionpublic void close()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||