SMTPSend.mesa
Last Edited by: HGM, March 24, 1984 6:40:11 pm PST
Last Edited by: DCraft, December 4, 1983 3:48 pm
Last Edited by: Taft, January 3, 1984 2:16 pm
John Larson, July 20, 1987 10:40:09 pm PDT
DIRECTORY
SMTPDescr USING [Descr],
Rope USING [ROPE];
SMTPSend: CEDAR DEFINITIONS = BEGIN
Connection: TYPE = REF ConnectionRep;
ConnectionRep: TYPE;
totalArpaMsgsSent: INT;
totalArpaBytesSent: INT;
Open: PROC [hostName: Rope.ROPE] RETURNS [hostStream: Connection];
! Failed
Open an SMTP connection to the relay/ recipient host. Separate open, send, and close procedures are provided so that all outstanding messages to a host may be sent down the same stream.
SendItem: PROC [descr: SMTPDescr.Descr, recipList: LIST OF Rope.ROPE, hostStream: Connection];
! Failed
Send the given mail item down the host stream.
Close: PROC [hostStream: Connection, trouble: BOOL];
Close the stream. OK to multiply close a stream or to close an aborted one.
Failed will be raised by Open if the given host name is unknown or if the host won't respond (or if there is some local problem, probably a server bug). Failed will be raised by SendItem if it is unable to send the item completely successfully (e.g. one of the recipients was unknown). The withItem result indicates what the client should do with the item (or all items to that host if raised by Open). In the case of retryLater and putOnBadQueue, reason is a failure reason and should be noted with the item; in the case of returnToSender, reason should be included in the return text preamble. ProblemWithHost indicates whether the problem was with the remote host (thus, the sending of further items should be delayed) or with the specific item being sent. If the problem was with the host, the stream should not be reused. Open and SendItem do the necessary logging.
Failed: ERROR [withItem: WithItemAction, reason: Rope.ROPE, problemWithHost: BOOL];
WithItemAction: TYPE = {irrelevant, retryLater, putOnBadQueue, returnToSender};
END.