SMTP is the protocol which carries Internet mail messages. The class Smtp
provides a stackable comms module which offers SMTP support. The related class
SmtpMessage encapsulates a message to be sent
using the SMTP protocol. The Mime class assists
in the construction of messages which have attachments.
SMTP is defined in the standards document RFC 821
The module directly below the Smtp module must be a
Util module. There are no requirements on the
bottom module on the stack, though often it is a Tcp module.
The create function can be used to create an Smtp
module eg.
(create Smtp)
Once created, this module is tailored using its properties
and methods.
However, an Smtp module is often created in the process of
creating a comms stack by using the function
buildCommsStack.
An Smtp module supports the following properties:
| property name | property type | description |
|---|---|---|
localMailDomain |
String | name of the local mail domain - some mail servers require us, the mail client, to identify our mail domain when connecting. |
remoteMailDomain |
String | name of the remote mail domain - filled out on connection |
stack |
Stack | the layers of the stack below this module in the full stack |
log |
Log | a log for the POP3 connection |
errorClass |
Integer | class of SMTP-specific errors |
The Smtp module supports the following standard
comms module methods:
| method name | description |
|---|---|
connect |
connect this module |
send |
send the supplied SmtpMessage object |
noop |
perform a null operation on the SMTP server -- to check the connection is working |
reset |
reset the connection with the mail server |
disconnect |
disconnect this module |
In addition, it supports the following SMTP-specific methods:
| method name | description |
|---|---|
reset |
reset the connection with the mail server |
sendSend the supplied SmtpMessage object.
Arguments:
| msg | SmtpMessage |
Return type: String an identifier for
the message
noopPerform a null operation on the SMTP server -- to check the connection is working
Arguments: none
Return type: the empty List ()
or the String returned by the server.
reset
Reset the connection with the mail server. This implements the SMTP command
RSET.
Arguments: none
Return type: the empty List ()
| Contents | Index | Current topic: communications | Related topics: communications classes, objects |