Z-MAILAX

This document covers the following topics:


Description

Send an application, document, memo, menu, phone message, procedure, program, reference document or user-defined object.

This subprogram is the same as Z-MAILA with the one exception that the parameter Object-ISN uses the format P10.

Z-MAILAX does not contain any forward or reply logic. It simply sends the specified item as normal mail. It does not validate the mail information for external addressees. External mail can only be sent using a nickname; in this case the physical address (i.e. telex number etc.) must be fully defined.

Z-MAILAX can be used in conjunction with other API subprograms. The subprograms should be invoked in the following sequence:

  1. Z-MLDFLT (to modify the send defaults and/or define suspended delivery for transport service items).

  2. Z-MAILAX.

  3. Z-CNFIRM (if suspended delivery was defined for transport service items).

You can send an object to as many as 12 addressees. To mail the object to additional addressees, you can re-invoke this subprogram with no changes to the parameter list - except for the specification of further addressees and mail types.

When sending a memo, the parameters Addressees, Cover-note-text, Cabinet, Subject, and Object-number (using object number 11) are required; you must leave the parameters Object-name and Object-ISN blank.

When sending a phone message, the parameters Addressees, Cover-note-text, Cabinet, Subject, and Object-number (using object number -11) are required; you must leave the parameters Object-name and Object-ISN blank. When the phone message is sent, it is delivered to the addressee's Inbasket file Phone. Sending a phone message in this manner does not use the "Send Phone Message" screen. Therefore, you must specify the necessary information such as the phone number and the caller's name in the parameter Subject.

Different address types can be created using the same name (e.g. a user ID may coincide with a distribution list name). If the address type is not specified and addressees with the same name, but different address types are found, the system first tries to send to address type 33 (user ID) and then to 5 (cabinet). It does not check any other address types. For example, if the system locates an addressee with the specified name in address type 33, it is sent to this addressee. If not, the system tries to send to address type 5. If an addressee with the specified name is not found in either address types, return code 34 is returned.

An Outbasket record is created for the object and then that record is copied for each of the addressee parameters. If the item is mailed, the parameter Object-ISN is set to the *ISN of the Outbasket record which was created, and the Object-name parameter is reset. If an addressee is not found, the return code is set to 21 and the ID is passed back to the calling program.

Z-MAILAX creates an address list and performs limited security checking - i.e. validates the send level and the number of addressees, and validates the access to the sender's cabinet and to the object.

When you send mail from a shared or public cabinet, your user ID is specified as the sender and not the ID of the cabinet from which the item was sent (this description does not apply when you send mail from a private or standalone cabinet).

When a value other than 0 is returned in the parameter Return-code, BACKOUT TRANSACTION is always issued.

When you send a memo or an object with a cover note, Z-MAILAX automatically uses the source area defined with DEFINE PRINTER (1) OUTPUT 'SOURCE'.

When external mail items (e.g. SNADS) are created with this API subprogram, it is imperative that X-0INIT is called after Z-MAILAX is executed. X-0INIT automatically invokes X-FZ, which is used to transmit external mail items onto the recipient nodes.

Parameters

Parameter Format In Out Remarks
Return-code N2 O X Input -1: no ET. When you send a mail item to external addressees using the transport service, END TRANSACTION will occur even if the parameter Return-code is set to -1.
Addressees A20/1:12 R X The names or user IDs of the addressees.
Address-type N2/1:12 O   Must be one of the following: 1=address (nickname), 4=bulletin board, 5=cabinet, 10=distribution list, 33=user ID, 70=last name, 74=external.
Mail-type A1/1:12 O   O=original, C=copy, B=blindcopy, P=private mail. Default: O. In a shared or public cabinet, you must not specify mail type P.
Cabinet A8 R   The cabinet from which the object is to be sent.
Password A8 R   The password of the above cabinet.
Sender-name A20     For internal use.
Object-number N2 R   The type of object to be sent. Must be one of the following: 2=application, 11=document/memo, -11=phone message, 18=menu, 24=procedure, 26=program, 27=reference document, 80 to 99=user-defined object.
Object-name A32 R*   The name of the object to be sent. Either Object-name or Object-ISN, not both. When sending a memo or phone message, this parameter must be empty.
Object-ISN P10 R* X Input: The ISN of the object to be sent. Either Object-ISN or Object-name, not both. When sending a memo or phone message, this parameter must be empty. Output: The ISN of the new Outbasket record.
Cover-note-text A76/1:16 O   When sending a memo, this parameter is required.
Subject A60 R   The subject for the mail item.
Work-parameter A128     For internal use. See The Work Parameter.

Return Codes

00 Success
02 Invalid cabinet name or - in batch mode only - locked cabinet
03 Invalid password
04 ISN was not found
08 Supply either ISN or name, not both
09 ISN does not point to an object
21 Addressee not found
22 Can't create spool-file entry
23 Sender cabinet ID not found
24 Security violation (wrong level for mailing)
25 More addressees than allowed for sender's cabinet
26 Document-name was not found in sender's cabinet
27 Cover note is required
28 Subject is required
29 Cover note could not be saved
33 Addressee not unique
34 Address type not found
91 This type of object cannot be mailed
92 Sending objects from the Inbasket or Wastebasket is not allowed
93 Parameter Object-ISN or Object-name cannot be specified with a phone message
94 Unable to create a transport service item

Subprograms

This list does not include the subprograms that are invoked by Z-CNFIRM.

Z-110
Z-120
Z-122
Z-123
Z-135
Z-145
Z-147
Z-155
Z-165
Z-175
Z-185
Z-190
Z-191A
Z-194
Z-197A
Z-200A
Z-201
Z-202
Z-205
Z-207
Z-241
Z-1200&0
Z-CNFIRM (only called if no other definition was made with Z-MLDFLT)

Example

0010 *
0020 * Example program to send an application, document, memo, menu,
0030 * phone message, procedure, program, reference document or
0040 * user-defined object.
0050 *
0060 DEFINE DATA
0070 LOCAL
0080 1 RETURN-CODE           (N2)
0090 1 ADDRESSEES            (A20/1:12)
0100 1 ADDRESS-TYPE          (N2/1:12)
0110 1 MAIL-TYPE             (A1/1:12)
0120 1 CABINET               (A8)
0130 1 PASSWORD              (A8)
0140 1 SENDER-NAME           (A20)
0150 1 OBJECT-NUMBER         (N2)
0160 1 OBJECT-NAME           (A32)
0170 1 OBJECT-ISN            (P10)
0180 1 COVER-NOTE-TEXT       (A76/1:16)
0190 1 SUBJECT               (A60)
0200 1 WORK-PARAMETER        (A128)
0210 *
0220 END-DEFINE
0230 *
0240 RESET RETURN-CODE
0250 MOVE 'User ID ' TO ADDRESSEES(1)
0260 MOVE 33         TO ADDRESS-TYPE(1)
0270 MOVE 'O'        TO MAIL-TYPE(1)
0280 MOVE 'Nickname' TO ADDRESSEES(2)
0290 MOVE 01         TO ADDRESS-TYPE(2)
0300 MOVE 'C'        TO MAIL-TYPE(2)
0310 *
0320 MOVE 'CABINET'  TO CABINET
0330 MOVE 'PASSWORD' TO PASSWORD
0340 MOVE 11         TO OBJECT-NUMBER
0350 MOVE 1234567890 TO OBJECT-ISN
0360 MOVE 'Cover note text' TO COVER-NOTE-TEXT(1)
0370 MOVE 'Document mail'   TO SUBJECT
0380 *
0390 CALLNAT 'Z-MAILAX'
0400   RETURN-CODE
0410   ADDRESSEES(*)
0420   ADDRESS-TYPE(*)
0430   MAIL-TYPE(*)
0440   CABINET
0450   PASSWORD
0460   SENDER-NAME
0470   OBJECT-NUMBER
0480   OBJECT-NAME
0490   OBJECT-ISN
0500   COVER-NOTE-TEXT(*)
0510   SUBJECT
0520   WORK-PARAMETER
0530 *
0540 IF  RETURN-CODE EQ 0
0550   WRITE 'Document was sent'
0560 ELSE
0570   WRITE 'Return code ' RETURN-CODE
0580 END-IF
0590 *
0600 END