Send a file to an email destination

This example shows how to send a file to an email destination and assumes that:
  • The administrator set up a printer definition mail in the Printer Inventory.
  • The email protocol is selected and an email address is specified in the printer definition mail for the primary recipient. However, the email address that you specify in the mail-to-addresses job attribute overrides the email address in the printer definition.
  • A form definition is to be used when the AFP file is transformed to PDF format.
  • The AFP to PDF transform is specified in printer definition mail.
  • AFP resources libraries are specified either in the printer definition or in the transform configuration file, aopxfd.conf. If the AFP resource libraries are not specified elsewhere, specify the libraries in the resource-library job attribute.
//JOBA     JOB  D31,'H. EVANS'
//EMAIL    EXEC AOPPRINT,PRINTER='mail',
//     OPTIONS='attributes=//DD:MYATTR'
//SYSIN    DD   DSNAME=FILE1.AFP,DISP=SHR
//MYATTR   DD   *
mail-to-addresses={'user1@xyz.com'}
mail-cc-addresses={'user2@xyz.com'}
mail-bcc-addresses={'user3@xyz.com'}
mail-from-name="John Q. Sender"
mail-reply-address='secretary@xyz.com'
mail-file-name="January report"
title-text="Monthly Report"
form-definition=F1MYDEF
/*
 
Rules: In this example, the EXEC statement continues on a second line because a single line would be longer than 71 characters. When you continue a JCL statement, observe these rules:
  1. Break after a complete parameter or subparameter, at or before column 71. A comma belongs with the preceding parameter or subparameter.
  2. Code // in columns 1 and 2 of the continuation line.
  3. Leave column 3 of the continuation line blank.
  4. Continue the interrupted parameter or field, starting in any column 4 - 16.
Results:
  1. The recipient of the email is user1@xyz.com.
  2. The copy (cc) recipient of the email is user2@xyz.com. A cc means that other recipients of the email can see the cc recipient listed.
  3. The blind copy (bcc) recipient of the email is user3@xyz.com. A bcc means that other recipients of the email do not see the bcc recipient listed.
  4. The sender of the email is John Q. Sender<JOHN@SYSTEM1>. JOHN is the user ID of the user who ran the job, and SYSTEM1 is the system where z/OS UNIX sendmail is running.
  5. The email address that recipients of an email can reply to is secretary@xyz.com.
  6. File FILE1.AFP is attached to the email. The name of the attachment is January report.pdf. The file is in PDF format because the AFP to PDF transform is specified in the printer definition. The file can be viewed and printed with a PDF viewer such as Adobe Acrobat Reader.
  7. The subject of the email is Monthly Report.