View previous topic :: View next topic
|
Author |
Message |
upendrasri
Active User
Joined: 28 Sep 2017 Posts: 124 Location: India
|
|
|
|
Hi All,
Using below REXX am able to send an email without any issue.
Code: |
/* REXX */
LPAR = 'TEST LPAR '
SMTP.1 = 'HELO' MVSVAR('SYSNAME')
SMTP.2 = 'MAIL FROM:<TEST123@CAP.NET>'
SMTP.3 = 'RCPT TO:<TEST123@CAP.NET>'
SMTP.4 = 'DATA'
SMTP.5 = 'FROM:<TEST123@CAP.NET>'
SMTP.6 = 'TO:<TEST123@CAP.NET>'
SMTP.7 = 'SUBJECT:'LPAR'-DETAILS'
SMTP.8 = 'THESE DETAILS ARE TEST LPAR DETAILS '
"ALLOC F(SMTPOUT) SYSOUT(B) WRITER(SMTP)"
IF RC <> 0 THEN DO
SAY 'ERROR ALLOCATING SYSOUT FOR SMTP WRITER'
EXIT 12
END
"EXECIO * DISKW SMTPOUT (STEM SMTP. FINIS"
IF RC <> 0 THEN DO
SAY 'ERROR WRITING SYSOUT FOR SMTP WRITER'
|
But in my email body am getting below message
THESE DETAILS ARE TEST LPAR DETAILS
My query is, Incase if I keep my email body message in a mainframe PS dataset then how can represent dataset name in above rexx code?
Any suggestions?
Upensri |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
You would just need to copy from your input data set to the SYSOUT(B) file. I suggest to use IEBGENER utility. Something like this (untested):
Code: |
/*rexx */
Address TSO
"ALLOC FILE(SYSIN) DUMMY REU"
"ALLOC FILE(SYSPRINT) BLKSIZE(2660) LRECL(133) NEW REU",
" SPACE(1,1) TRACK RECFM(F,B) "
"ALLOC FILE(SYSUT1) DA(my.email.txt) SHR REU"
"ALLOC FILE(SYSUT2) SYSOUT(B) WRITER(SMTP)"
Address LINKMVS "IEBGENER"
say 'IEBGENER rc=' rc
If rc \= '0' Then
Do
"EXECIO * DISKR SYSPRINT ( FINIS STEM OUTPUT."
Do xx = 1 to output.0
say output.xx
End
End
"FREE FILE(ISYSIN,SYSPRINT,SYSUT1,SYSUT2)"
Exit 0
|
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Code: |
/* REXX */
LPAR = 'TEST LPAR '
/* put SMTP header into program stack */
Queue 'HELO' MVSVAR('SYSNAME')
Queue 'MAIL FROM:<TEST123@CAP.NET>'
Queue 'RCPT TO:<TEST123@CAP.NET>'
Queue 'DATA'
Queue 'FROM:<TEST123@CAP.NET>'
Queue 'TO:<TEST123@CAP.NET>'
Queue 'SUBJECT:'LPAR'-DETAILS'
/* Queue 'THESE DETAILS ARE TEST LPAR DETAILS ' */
"ALLOC FILE(MSGTEXT) DA(‘library(member)’) SHR REU"
IF RC <> 0 THEN DO
SAY ‘ERROR ALLOCATING MSGTEXT FOR SMTP MESSAGE’
EXIT 12
END
“EXECIO * DISKR MSGTEXT (FINIS” /* read whole text into program stack */
“FREE F(MSGTEXT)”
"ALLOC F(SMTPOUT) SYSOUT(B) WRITER(SMTP)"
IF RC <> 0 THEN DO
SAY 'ERROR ALLOCATING SYSOUT FOR SMTP WRITER'
EXIT 12
END
/* write from program stack to SMTP output */
"EXECIO” Queued() “DISKW SMTPOUT ( FINIS"
IF RC <> 0 THEN DO
SAY 'ERROR WRITING SYSOUT FOR SMTP WRITER'
EXIT 12
END
“FREE F(SMTPOUT)”
RETURN
|
|
|
Back to top |
|
|
upendrasri
Active User
Joined: 28 Sep 2017 Posts: 124 Location: India
|
|
|
|
Hi sergeyken
Its working ..
Great thanks.. |
|
Back to top |
|
|
upendrasri
Active User
Joined: 28 Sep 2017 Posts: 124 Location: India
|
|
|
|
Hi Pedro,
Thanks for your suggestion. I tried with IEBGENER and its working fine...
Great thanks. |
|
Back to top |
|
|
|