SimpleMailerDoc.tioga
Carl Hauser, August 4, 1986 6:40:57 pm PDT
Swinehart, February 18, 1987 5:48:31 pm PST
Doug Terry, July 19, 1990 4:25:37 pm PDT
SimpleMailer
CEDAR 7.0 —
SimpleMailer
An easy way to send mail from programs
Carl Hauser
© Copyright 1986, 1987 Xerox Corporation. All rights reserved.
Abstract: SimpleMailer provides a programmer's interface for sending a mail message with a single procedure call.
Created by: Carl Hauser
Maintained by: Carl Hauser <CHauser.pa>
Keywords: mail, send, Grapevine
Commands: none
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

Introduction
A convenient way for Cedar servers to communicate with their human administrators is for the servers to send mail. But doing so with MailSend is a pain because a complicated protocol must be obeyed to construct the message. SimpleMailer will do the MailSend protocol for you, given only the desired contents of the message fields.
SimpleMailer will automatically choose a mail transport protocol, e.g. Grapevine or XNS, that is appropriate for the given recipient names. That is, if you present SimpleMailer with a list of XNS names then it will send the message via XNS mail servers; if you give it Grapevine names then it will use Grapevine mail servers.
How to use it
Load files for programs using SimpleMailer should contain
Install SimpleMailer
Client programs use the SimpleMailer interface, which contains a single procedure
SendMessage: PROC [from: ROPENIL, to, cc: LIST OF MailBasics.RName ← NIL, subject: ROPENIL, otherHeader: ROPENIL, body: ROPENIL, validate: BOOLTRUE, sendIfValidateFails: BOOLFALSE, credentials: MailSend.SendingCredentialsList ← NIL]
RETURNS [sent: BOOL, failureReason: ROPE];
Here are a couple of examples of simple calls (invoked via the Cedar interpreter on a Dorado):
&1 ← SimpleMailer.SendMessage[]
=> [sent: FALSE, failureReason: "No recipients."]
&2 ← SimpleMailer.SendMessage[to: LIST[[$xns, "Swinehart"]], body: "Hi there."]
=> [sent: TRUE, failureReason: NIL]
&3 ←
Credits
Credit for this goes mostly to the implementors of AlpineBackup and SendMailTool, from whence the code was stolen.