Library: Email support, SMTP and POP3 (OMMAIL)

Returns: An external output object.

define external string sink function MailOutBoxSendMail
           value MailOutBox this-MailOutBox
   to      value string recipient
   subject value string subject optional initial {""}
   header  value string header-info optional

Argument definitions

is an OMX component of type MailOutBox.
is the email address or addresses to which the message is being sent; a single address or a comma-separated list of email addresses.
is an optional subject field.
is where you can optionally specify header information, according to the mail-header protocol.


This function sends a mail message with the specified subject, mail header, and recipient or recipients. It returns an external output object which is used to send the body of the message. As you write to the stream, the message parts are sent out (there is no buffering of the message). Closing the stream attached to this external output object signals the end of message composition and triggers the completion of the delivery of the message. It is an error to reopen a stream attached to an external output object derived from a mail outbox object, once that stream has been closed.


    include ""
         local stream msg
         local stream t-Error variable initial-size 0
         local MailOutBox this-MailOutBox
         set this-MailOutBox to MailOutBoxCreate name "joe" address ""
         open msg as MailOutBoxSendMail this-MailOutBox
            to ""
            subject "Greetings"
         MailOutBoxGetStatusReport this-MailOutBox into t-Error
         repeat over t-Error
            put #error t-Error
         halt when number of t-Error > 0
         put msg "Just wanted " || "to say " || "hello." || "%n"
         close msg
         ; Note: the close action sent the msg