Examples

The following examples show valid use of EMAIL commands.

Example 1

The following WFL job initiates EMAIL to send a message:

BEGIN JOB EMAIL/EXAMPLE;
RUN OBJECT/EMAIL ("SEND JohnSmithwork.com//Subject//Message");
END JOB;

Example 2

The following CANDE UTILITY command initiates EMAIL to send a message:

U EMAIL SEND JohnSmithwork.com//Subject//Message

Example 3

The following CANDE RUN command initiates the EMAIL utility to send a message with an attachment:

R EMAIL("send: att [PDUMP/OBJECT/TEST/001 as *PDUMP/TEST]
               #support//TEST PDUMP")

Example 4

The following code illustrates declaring and invoking the EMAIL utility from an ALGOL client:

LIBRARY EMAILSUPPORT (LIBACCESS=BYFUNCTION);
REAL PROCEDURE EMAIL (P);  VALUE P;  POINTER P;
LIBRARY EMAILSUPPORT;
REPLACE P BY "SEND JohnSmith@work.com//Subject//Message" 48"00";
EMAIL (P);

Example 5

The following code illustrates invoking the EMAIL utility from a COBOL client:

WORKING-STORAGE SECTION.
77 RESULT   USAGE REAL.
77 LNGTH    PIC S9(11) USAGE BINARY EXTENDED.
01 MSG      PIC X(180).
MOVE "SEND JohnSmith@work.com//Subject//Message" TO MSG.
MOVE 41 TO LNGTH.
CHANGE ATTRIBUTE LIBACCESS OF "EMAILSUPPORT" TO BYFUNCTION.
CALL "EMAIL_COB IN EMAILSUPPORT" USING MSG, LNGTH GIVING RESULT.
IF RESULT IS NOT EQUAL TO ZERO
    CHANGE ATTRIBUTE STATUS OF MYSELF TO 

Example 6

The following code illustrates invoking EMAIL from a LINC client:

CALL; BYFUNCTION  (EMAILSUPPORT)  :: done only once
MOVE; (send JohnSmith@work.com//Subject//Message) GLB.PARAM
CALL; (EMAIL_LINC)  (EMAILSUPPORT)
::: EMAIL result stored in first 3 characters of GLB.PARAM.
::: EMAIL warning stored in second 3 characters of GLB.PARAM.

Example 7

The following WFL job uses KIND=READER files to specify the TO list and the body:

BEGIN JOB TEST/KIND/READER;
 RUN *OBJECT/EMAIL("SEND //TO READER Test//Test Message");
    FILE TO(KIND=READER);
DATA TO
JohnSmith@work.com
? % END of DATA TO
%%
 RUN *OBJECT/EMAIL("SEND *//BODY READER Test");
    FILE BODY(KIND=READER, TITLE=READER);
DATA READER
This is the first line of the email body.
This is the last line of the KIND=READER test.
? % END of DATA READER
END JOB.

Additional CANDE Examples

  • To send a message to yourself:

    R EMAIL("send *//Testing//One, Two, Three. ^^My Name")
  • To send yourself a message containing temp/welcome.htm as an attachment:

    R EMAIL("send:a temp/welcome.htm *//htm File//Check the attachment")
  • To send a DATA file as a text attachment to yourself:

    R EMAIL("send:a MY/DATA/FILE AS example.txt *//Example") 
  • To send a printer backup file as the contents of a message to user GEORGE whose e-mail address is defined in his USERDATA record:

    R EMAIL("send GEORGE//Results"); %
    FILE BODY=*BD/TEST/RESULTS ON BACKPACK
  • To send a program dump to your SUPPORT contact (using the alias defined in your CANDE/MYOPTIONS file):

    R EMAIL("send a PDUMP/OBJECT/PROGRAM/001 #SUPPORT//PDUMP//%
    Attached is the PDUMP file that you requested.^^My Name")
  • To submit a news article to the comp.sys.unisys.newsgroup using your signature file NEWS/DISCLAIMER:

    R EMAIL("submit: sig=NEWS/DISCLAIMER, %
    from=""My Name""<NoSpamhere.com> comp.sys.unisys//Test Results %
    //Here are my test results:^^"); FILE BODY=TEST/RESULTS