Sending Email with attachments via REXX
Posted: Fri Aug 14, 2009 4:48 am
I'm looking for a REXX code to send emails with attachmnets. i found one example but thats without attachments. I'm also not sure where will I find the list of all SMTP. variables used in this example. Also I did not find the SMTP WRITER extension of ALLOCATE command
But following is the example that sends mail without attachmnet and it works.
But following is the example that sends mail without attachmnet and it works.
/* REXX - 08/10/09 */
PARSE ARG RECPT MSG
SMTP.1 = 'HELO' MVSVAR('SYSNAME')
SMTP.2 = 'MAIL FROM:<MYNAME@MYORG.COM>'
SMTP.3 = 'RCPT TO:<'RECPT'>'BNAME")) OLD REUSE"
SMTP.4 = 'DATA'
SMTP.5 = 'FROM MAIN FRAME RACF ID ' MVSVAR('SYSSECLAB')
SMTP.6 = 'TO:' RECPT
SMTP.7 = 'SUBJECT: JES2LOG FOR JOB ' JOBNAME
SMTP.8 = MSG
"ALLOC F(SMTPOUT) SYSOUT(A) WRITER(SMTP)"
IF RC <> 0 THEN DO
SAY 'ERROR ALLOCATING SYSOUT FOR SMTP WRITER'
EXIT 12
END
SAY 'ALLOCATED ' SMTPOUT
"EXECIO * DISKW SMTPOUT (STEM SMTP. FINIS"
"FREE F(SMTPOUT)"
PARSE ARG RECPT MSG
SMTP.1 = 'HELO' MVSVAR('SYSNAME')
SMTP.2 = 'MAIL FROM:<MYNAME@MYORG.COM>'
SMTP.3 = 'RCPT TO:<'RECPT'>'BNAME")) OLD REUSE"
SMTP.4 = 'DATA'
SMTP.5 = 'FROM MAIN FRAME RACF ID ' MVSVAR('SYSSECLAB')
SMTP.6 = 'TO:' RECPT
SMTP.7 = 'SUBJECT: JES2LOG FOR JOB ' JOBNAME
SMTP.8 = MSG
"ALLOC F(SMTPOUT) SYSOUT(A) WRITER(SMTP)"
IF RC <> 0 THEN DO
SAY 'ERROR ALLOCATING SYSOUT FOR SMTP WRITER'
EXIT 12
END
SAY 'ALLOCATED ' SMTPOUT
"EXECIO * DISKW SMTPOUT (STEM SMTP. FINIS"
"FREE F(SMTPOUT)"