MSSend.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Doug Terry, November 11, 1988 12:23:03 pm PST
Wes Irish, December 21, 1988 4:09:30 pm PST
Willie-Sue, December 30, 1988 4:41:33 pm PST
Willie-s, December 10, 1991 5:16 pm PST
Operations for sending electronic mail messages to XNS mail servers. This interface is modeled after GVSend to ease the transition...
DIRECTORY
Rope USING [ROPE],
MailTransportP17V5,
MSBasics USING [BodyPartType, RName],
XNS USING [Address, unknownAddress];
MSSend: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
These defs allow clients to inject messages into the XNS mail system. They are designed so that they can be used by multiple processes creating different messages; the state of creation of a single message is represented by a "Handle". The interface is also designed so that it may be implemented either by transmission over the network to a remote mail server, or by calls on a local mail server.
Handle: TYPE = REF;
InvalidNameList: TYPE = MailTransportP17V5.InvalidNameList;
Create: PROC RETURNS [handle: Handle];
For any one Handle, the following calls must be made in the order:
StartSend,
AddRecipient, AddRecipient, AddRecipient, . . .
StartItem, (AddToItem, AddToItem, . . .), StartItem, (...), . . .
Send
Abort may be called at any point to abandon the sequence. A Handle may be re-used. "Abort" happens implicitly if needed sometime after the last reference to the Handle goes away.
SendFailed: ERROR [why: Rope.ROPE, notDelivered: BOOL] ;
"StartSend" raises no signals that may be caught by the client. The ERROR "SendFailed" may be raised by any of AddRecipient, StartItem, AddToItem, or Send if some communication failure occurs. If it is raised, the client should generally catch it, go back to the start of the message, and re-call "StartSend". "StartSend" will then attempt to find a better mail server to talk to. Only when "StartSend" returns "allDown" is it not possible to
send the message. The client may want to inform the user if this
re-try mechanism has been invoked.
StartSendInfo: TYPE = { ok, badPwd, badSender, badReturnTo, allDown };
SetPostingServer: PROC [handle: Handle, server: XNS.Address ¬ XNS.unknownAddress];
Sets the posting server for the particular handle. If server = unknownAddress then posting is done to the "best-choice" available server (the default for the handle when created). Any address other than unknownAddress specifies a particular server for posting -- if that server is not available you will get "allDown" (from operations that return such).
StartSend: PROC [handle: Handle,
senderPwd: ROPE,
sender: MSBasics.RName,
returnTo: MSBasics.RName ¬ NIL]
RETURNS [StartSendInfo];
Starts a message. If "returnTo" is NIL, the sender name is used as return-to name. If "sender" = NIL then the currently logged in user is used as the sender.
AddRecipient: PROC [handle: Handle, recipient: MSBasics.RName];
Adds to the recipient list.
StartItem: PROC [handle: Handle, type: MSBasics.BodyPartType];
Start a message body part.
AddToItem: PROC [handle: Handle, buffer: ROPE];
Add the data to the current message body part.
Send: PROC [handle: Handle, validate, allowDLRecipients: BOOL]
RETURNS [sent: BOOL, invalidNames: InvalidNameList];
Send the message. If validate=TRUE then the message will only be sent if all names are valid. Any invalid names will be returned in invalidNames. "sent" reflects if the message was actually sent or not.
May raise SendFailed
Abort: PROC [handle: Handle];
Abandon the message. May be called at any time.
END.