All Packages Class Hierarchy This Package Previous Next Index
Class netscape.messaging.smtp.SMTPClient
java.lang.Object
|
+----netscape.messaging.smtp.SMTPClient
- public class SMTPClient
- extends Object
The SMTPClient class represents the SMTP client.
The client uses this class for communicating with a
server using the SMTP protocol.
The SMTP client conforms to the specifications of the client
described in RFC 821.
For a list of the SMTP RFCs referenced in the
Messaging Access SDK and their URLs,
see "Where to Find More Information" in "About This Book."
-
SMTPClient(ISMTPSink)
- Constructor for SMTPClient that takes an SMTPSink as a parameter.
-
bdat(byte[], int, int, boolean)
- Sends binary data chunks to the server.
-
connect(String)
- Connects to the server using the default port.
-
connect(String, int)
- Connects to the server using the specified port.
-
data()
- Prepares to send data to the server.
-
disconnect()
- Closes the socket connection with the server.
-
ehlo(String)
- Determines the ESMTP server extensions.
-
expand(String)
- Expands a given mailing list.
-
help(String)
- Obtains help on a given topic.
-
mailFrom(String, String)
- Sets the sender of the message with optional ESMTP parameters.
-
noop()
- Gets positive server response; does not affect SMTP session.
-
processResponses()
- Reads in responses from the server and invokes the appropriate sink methods.
-
quit()
- Closes the connection with the server.
-
rcptTo(String, String)
- Sets the recipient of the message with optional ESMTP parameters.
-
reset()
- Resets the state of the server; flushes any sender and recipient
information.
-
send(InputStream)
- Sends message data to the server.
-
sendCommand(String)
- Sends an unsupported command to the server.
-
setChunkSize(int)
- Sets the size of the data chunks that are read from the input stream and
sent to the server.
-
setPipelining(boolean)
- Enables PIPELINING (batching) of commands, if supported by the server.
-
setResponseSink(ISMTPSink)
- Registers a new response sink, overriding the one passed into the
constructor or any one set afterwards.
-
setTimeout(int)
- Sets the amount of time allowed to wait
before returning control to the user.
-
verify(String)
- Verifies a username.
SMTPClient
public SMTPClient(ISMTPSink in_sink)
- Constructor for SMTPClient that takes an SMTPSink as a parameter.
- Parameters:
- in_sink - Response sink that implements the ISMTPSink interface.
- See Also:
- ISMTPSink
bdat
public synchronized void bdat(byte in_data[],
int in_offset,
int in_length,
boolean in_fLast) throws IOException
- Sends binary data chunks to the server.
Not to be used with the data() command.
With SMTPClient.send(), data should be sent with SMTPClient.data
and not with SMTPClient.bdat.
For more information, see "Sending the Message."
Note: bdat is not supported by Messaging Server 4.0. Use SMTPClient.data instead.
- Parameters:
- in_data - Array for the raw data to send to the server.
- in_offset - Offset for data.
- in_length - Number of bytes to send.
- in_fLast - Indicates whether this is the last chunk of data to send.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- bdat, error, data
connect
public synchronized void connect(String in_server) throws IOException
- Connects to the server using the default port.
To specify the connection port, use the
form of connect that takes a port number.
- Parameters:
- in_server - Name of the host server to connect to.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- connect, error, quit, connect
connect
public synchronized void connect(String in_server,
int in_port) throws IOException
- Connects to the server using the specified port.
To use the default connection port, use the
form of connect that takes only the server name.
- Parameters:
- in_server - Name of the host server to connect to.
- in_port - Number of the port to connect to.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- connect, #error, quit, connect
data
public synchronized void data() throws IOException
- Prepares to send data to the server.
With SMTPClient.send(),
data should be sent with SMTPClient.data and not with SMTPClient.bdat.
For more information, see "Sending the Message."
Note: Not to be used with the bdat() command.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- data, error
disconnect
public synchronized void disconnect() throws IOException
- Closes the socket connection with the server.
Can be used to perform a high level "Cancel" while
sending a message.
NOTE: Do not call processResponses() after this method.
- Throws: IOException
- thrown on IO error.
ehlo
public synchronized void ehlo(String in_domain) throws IOException
- Determines the ESMTP server extensions.
The callback on the response
sink identifies the various SMTP extensions supported by the server.
- Parameters:
- in_domain - The domain name.
- Throws: IOException
- thrown on IO error.
- See Also:
- ehlo, ehloComplete, error
expand
public synchronized void expand(String in_mailingList) throws IOException
- Expands a given mailing list.
Gets the email addresses of the users on the mailing list.
- Parameters:
- in_mailingList - The mailing list to expand.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- expand, expandComplete, error
help
public synchronized void help(String in_helpTopic) throws IOException
- Obtains help on a given topic.
- Parameters:
- in_helpTopic - One-word help topic to get information on. If null,
user may get Help on Help or a default. See implementation on the server.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- help, helpComplete, error
mailFrom
public synchronized void mailFrom(String in_reverseAddress,
String in_esmtpParams) throws IOException
- Sets the sender of the message with optional ESMTP parameters.
- Parameters:
- in_reverseAddress - Address of the sender of the message.
- in_esmtpParams - Any ESMTP (Extended SMTP) parameter.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- mailFrom, error, rcptTo
noop
public synchronized void noop() throws IOException
- Gets positive server response; does not affect SMTP session.
Issues Noop command.
The server responds to commands with a "still here" response.
Sending the noop method does nothing except force this server response.
Can be used to maintain server connection, perhaps being issued
at timed intervals to make sure that the server is still active.
Not needed by applications that do something and do not maintain a connection with the server.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- noop, error
quit
public synchronized void quit() throws IOException
- Closes the connection with the server.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- quit, error
rcptTo
public synchronized void rcptTo(String in_forwardAddress,
String in_esmtpParams) throws IOException
- Sets the recipient of the message with optional ESMTP parameters.
- Parameters:
- in_forwardAddress - Address of the message recipient.
- in_esmtpParams - Any ESMTP parameters to set.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- rcptTo, error
reset
public synchronized void reset() throws IOException
- Resets the state of the server; flushes any sender and recipient
information.
Cancels the current mail transfer and all current processes,
discards data, and clears all states. Returns to the state
that followed the last method that sent the EHLO command.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- reset, error, ehlo
send
public synchronized void send(InputStream in_inputStream) throws IOException
- Sends message data to the server.
NOTE: To be used with the data() command and not with the bdat() command.
- Parameters:
- in_inputStream - Input stream containing the data to send.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- send, error, data
sendCommand
public synchronized void sendCommand(String in_command) throws IOException
- Sends an unsupported command to the server.
Sends commands that are not supported by the Messaging Access SDK
implementation of SMTP.
NOTE: This method is primarily intended to support extensions
to the protocol to meet client application needs.
- Parameters:
- in_command - Raw command to send to the server.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- sendCommand, sendCommandComplete, error
verify
public synchronized void verify(String in_user) throws IOException
- Verifies a username.
- Parameters:
- in_user - User name to verify.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- verify, error
processResponses
public void processResponses() throws IOException
- Reads in responses from the server and invokes the appropriate sink methods.
Processes the server responses for API commands.
It invokes the callback methods provided by the user for all
responses that are available at the time of execution.
NOTE: If a timeout occurs the user can continue by calling processResponses() again.
- Throws: SMTPServerException
- If a server error occurs.
- Throws: InterruptedIOException
- If a time-out occurs.
- Throws: IOException
- If an I/O error occurs.
setChunkSize
public synchronized void setChunkSize(int in_chunkSize)
- Sets the size of the data chunks that are read from the input stream and
sent to the server. The minimum chunk size is 1024.
NOTE: Do not call processResponses() after this method.
- Parameters:
- in_chunkSize - Size of chunk used for sending messages using the send() method. Minimum chunk size: 1024. Default: 1 K.
- Throws: IOException
- thrown on IO error.
- See Also:
- send
setResponseSink
public synchronized void setResponseSink(ISMTPSink in_responseSink)
- Registers a new response sink, overriding the one passed into the
constructor or any one set afterwards.
NOTE: Do not call processResponses() after setResponseSink().
- Parameters:
- in_responseSink - The new ISMTPSink to use.
- Throws: IOException
- If an I/O error occurs.
- See Also:
- processResponses
setTimeout
public synchronized void setTimeout(int in_timeout) throws IOException
- Sets the amount of time allowed to wait
before returning control to the user.
NOTE: Do not call processResponses() after this method.
- Parameters:
- in_timeout - Time-out period to set. Values, in milliseconds:
- 0 = infinite time-out (default)
- -1 = no waiting
- > 0 = length of time-out period
- Throws: IOException
- If an I/O error occurs.
- See Also:
- processResponses
setPipelining
public synchronized void setPipelining(boolean in_enablePipelining) throws SMTPException
- Enables PIPELINING (batching) of commands, if supported by the server.
If PIPELINING is not supported by the server, an SMTPException
is thrown. The user can determine if PIPELINING is supported through the
notification of the ehlo() method.
NOTE: Do not call processResponses() after this method.
- Parameters:
- in_enablePipelining - Boolean value to enable/disable PIPELINING.
- Throws: SMTPException
- If PIPELINING is not supported by the server.
- See Also:
- ehlo
All Packages Class Hierarchy This Package Previous Next Index