Thanks for your help.
I will update you later.
Sending Email with attachments via REXX
-
- Posts: 70
- Joined: Tue Jul 28, 2009 5:03 am
- Skillset: DBA
- Referer: GOOGLE
-
- Posts: 272
- Joined: Mon Feb 25, 2008 3:53 am
- Skillset: None
- Referer: Google
- Location: Mumbai, India
Re: Sending Email with attachments via REXX
Though I'm quite late to party and with a usuless contibution to this thread but does this thread really belongs to the part of the forum known as "Suggestions & Feedback"? 

Anuj
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: Sending Email with attachments via REXX
Hi Anuj,
Probably not. . .
d
Probably not. . .

d
-
- Posts: 3
- Joined: Sun May 01, 2016 10:11 am
- Skillset: Operations and Batch Analyst, zOS Automation
- Referer: Found via many google searches
Re: Sending Email with attachments via REXX
I hunted everywhere for a solution to this, but figured it out. I hope this helps.
It will send a plain text dataset as a plain text attachment via Rexx & S/MIME
It will send a plain text dataset as a plain text attachment via Rexx & S/MIME
Code: Select all
/* Send dataset as an attachment via SMTP MIME */
recipient = 'someuser@somewhere.com'
jes_node = 'jes_node_name_to_get_to_smtp'
subj = 'Subject Line Here'
msg_body = 'Message Body Here'
full_dsdata_name = 'MAINFRAME_DATA_SET_NAME_HERE'
file_att = full_dsdata_name
SMTP.1 = "HELO "jes_node
SMTP.2 = "MAIL FROM:<somehost@someplace.com>"
SMTP.3 = "RCPT TO:<"recipient">"
SMTP.4 = "DATA"
SMTP.5 = "Date: "date(w) date(m) day year time()
SMTP.6 = "From: HOST <somehost@someplace.com>"
SMTP.7 = "To: <"recipient">"
SMTP.8 = "Subject: "subj
SMTP.9 = "MIME-VERSION: 1.0"
SMTP.10 = "CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY=""SIMPLE BOUNDARY"""
SMTP.11 = "--SIMPLE BOUNDARY"
SMTP.12 = "CONTENT-TYPE: TEXT/PLAIN"
SMTP.13 = " "
SMTP.14 = "Do not reply to this email"
SMTP.15 = " "
SMTP.16 = msg_body
SMTP.17 = "--SIMPLE BOUNDARY"
SMTP.18 = "CONTENT-DISPOSITION: ATTACHMENT; FILENAME="file_att".txt"
SMTP.19 = "CONTENT-TYPE: TEXT/PLAIN"
SMTP.20 = " "
Address "OPSDYNAM"
"allocate fi(input) dataset('"full_dsdata_name"') shr"
say "File" full_dsdata_name "allocated."
Address "TSO"
"execio * diskr input (finis"
/* Next line must equal the last hardcoded SMTP.XX number, adding 1 */
n = 21 /* This portion and below DO are needed to get this to work - SMTP.n is the line read from the file */
do while queued() > 0
parse pull mychain
SMTP.n = mychain
n = n + 1
end
SMTP.n = "."
n = n + 1
SMTP.n = "QUIT"
Address "OPSDYNAM"
"free f(input)"
Address "TSO"
"alloc f(smtpout) sysout(a) writer(cssmtp)" /* SMTP or CSSMTP */
say "CSSMTP writer Allocation Return Code:" rc
say "Allocated" SMTPOUT
Address "TSO"
"execio * diskw smtpout (STEM SMTP. FINIS"
say "EXECIO of SMTPOUT TO SMTP WRITER RETURN CODE:" rc
Address "OPSDYNAM"
"free f(smtpout)"
if rc = 0 then do
say "File" full_dsdata_name "sent to SMTP for attachment",
"processing."
end
/* End of send email attachment routine */
Regards,
James Quint, Jr
James Quint, Jr
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Sending o/p file's content to spool withot adding extra step
by Misha786 » Tue Jan 12, 2021 6:51 pm » in JCL - 4
- 2061
-
by sergeyken
View the latest post
Tue Jan 12, 2021 11:28 pm
-
-
- 12
- 3202
-
by sergeyken
View the latest post
Mon Sep 25, 2023 3:33 am
-
- 5
- 2733
-
by Pedro
View the latest post
Sat Feb 06, 2021 4:56 am
-
- 3
- 2252
-
by Robledo
View the latest post
Thu Mar 10, 2022 1:03 pm
-
- 2
- 1833
-
by prino
View the latest post
Sun Jun 16, 2024 12:38 am