SENDMAIL Command

The SENDMAIL command is a notification command that generates an email message to designated personnel.
am15
The SENDMAIL command is a notification command that generates an email message to designated personnel.
This command has the following format:
ADDRESS VOX "SENDMAIL TO(
recipientlist
) {MESSAGE(
text
) | VAR(
rexxvariable
)}   [SUBJECT(
text
)]   [SYSTEM(
sysname
)]   [CC(
recipientlist
)]   [BATCH(YES|NO)]   [MAILID(
text
)]   [ATTACHMENT(
filename
)]"
  • TO
    Specifies the primary recipients of the mail message.
    A
    recipient list
    is a list of one or more mail recipient names. The recipient names are text strings that the notification server attempts to resolve into e-mail addresses. If more than one name is listed, the names must be separated by a semicolon (;).
  • MESSAGE
    Specifies the text (or body) of the mail message. The maximum  allowed length is 240 characters. MESSAGE and VAR are mutually exclusive.
    Line control characters can be inserted into the text for customized message viewing.
  • VAR
    An optional method to specify the text (or body) of the mail message. The
    rexxvariable
     specified can be either a REXX variable or a stem variable. The REXX variable referenced by this VAR parameter can hold a maximum of 30,000 characters. Text from stem variables is concatenated (with one intervening blank) to form the mail text. MESSAGE and VAR are mutually exclusive. BATCH(YES) and VAR are mutually exclusive.
    Line control characters can be inserted into the text assigned to the specified REXX variable for customized message viewing.
  • SUBJECT
    (Optional) Subject of the mail message. The maximum length is 240 characters.
    Default:
    There is no default.
  • SYSTEM
    (Optional) Specifies the name of the system that is running the notification server to which you want to direct the command.
    The
    sysname
    value can contain up to eight alphanumeric characters.
    Default:
    The local system name
  • CC
    (Optional) List of recipient names to receive a copy of the mail message.
    If more than one name is listed, the names must be separated by a semicolon (;).
  • BATCH
    (Optional) Valid values are:
    • YES
      Executes the command by writing the command to an internal notification server input queue where it will be processed in batch mode.
    • NO
      Specifies that the issuing process waits for the return code and responses before returning to the issuer.
    Notes:
    • If issued with BATCH(YES), the return code you receive indicates only whether the command was properly queued for batch mode execution-it is not the completion code for the command.
    • BATCH(YES) and VAR are mutually exclusive.
    Default:
    NO
  • MAILID
    (Optional) User-supplied text to identify or track the mail message. This text is included in the last line of the identification section (generated by
    CA Automation Point
    ) that is appended to the mail body. The maximum length is 40 characters.
    Note:
    To use the MAILID option, you must enable Append Identification section to mail body on the Configure Mail dialog.
    Default:
    There is no default.
  • ATTACHMENT
    (Optional) User-supplied file which is to be attached to the mail message. The specified file name must be fully qualified and accessible from the Notification Server to which the SENDMAIL command is issued. Only one file can be specified per mail request. The maximum length of the file name including path is 512 characters.
    Default:
    There is no default.
    The attachment file must be located on the Notification Server. It is not possible to send attachments that are located on a machine that only uses VOX client and that connects to Notification Server.
Return Information:
After the SENDMAIL command executes, it sets the special REXX return code variable RC.
  • If a command executes successfully
    , the RC variable contains a value of zero.
  • If a command does not execute successfully
    , the RC variable contains one of the following values: 5341, 5344, 5346, 5347, 5348. (See for more information.) Additionally, the VOX.ERROR variable contains the complete VOX error message, which includes the four-digit return code and complete error message text.
Usage Note:
The SENDMAIL command displays the 5345I and 5349W messages in the window with the default name of AP Notification Messages.
Examples:
  • The following example illustrates how to use the SENDMAIL command:
    msgvar = "This email is to inform you that z/OS system Y has been IPLed" file="C:\TEMP\YourData.dat"  address VOX SENDMAIL TO(John Smith) CC(Jane Jones) SUBJECT(Notification from AP) VAR(msgvar) ATTACHMENT(path)
  • The following example illustrates how to programmatically add line control characters to customize message viewing:
    /* This is a sample program to take a screen   */   /* dump from session SYSA and send an email to */   /* support mailbox with the screen output.     */                 /* NOTE: This message must be viewed by the    */ /* recipient using a fixed pitch font.         */              session_name= 'SYSA' recipientlist='support'   ADDRESS AXC "GETSCRN SESSION("session_name") SCREEN(YES) PREFIX(LINE)" IF rc <> 0 THEN DO                 SAY 'GETSCRN failed with rc=' rc                 EXIT                 END   /* Add a line feed character (hex 0a) at the end of each line on the screen dump   */ /* Prefix each line with a tab character (hex 09)                                  */   line_feed= '0a'x tab= '09'x   DO i=1 to line.0 line.i=tab||line.i||line_feed end   ADDRESS VOX "SENDMAIL TO("recipientlist") VAR(line.) SUBJECT(Screen dump from Session "session_name")" IF RC <> 0 THEN SAY 'SENDMAIL with screen dump failed with rc=' rc