Page 1 of 2

Sending mail with attachment from JCL

PostPosted: Tue Jan 17, 2012 1:52 pm
by Anup Garude
Hi,

I am trying to send mail vai JCL using SMTP. I am receiving mail with attachment as well. However, attachment is empty.
Below is the JCL which I am using.

//SENDMAIL JOB (ACCT),'MAIL FILE',CLASS=A,MSGCLASS=Q,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//SENDMAIL EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP),DEST=(RD)
//SYSIN DD DUMMY
//SYSUT1 DD *
HELO DH
MAIL FROM:<XXX@aa.com>
RCPT TO:<ABC@xyz.com>
RCPT TO:<PQR@xyz.com>
RCPT TO:<XXX@xyz.com>
DATA
FROM:XXX <XXX@aa.com>
TO: <ABC@xyz.com>;<PQR@xyz.com>
CC: <XXX@xyz.com>
SUBJECT: TEST MAIL
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; boundary="simple boundary"

--simple boundary
Content-Type: text/plain;

Hi,

THIS IS A TEST MAIL TO check mail sending from MAINFRAMES.

REGARDS,
XXX
--simple boundary
Content-Type: text/plain; name="Data.txt"
Content-Disposition: attachment; filename="Data.txt"
// DD DSN=*******.APPL.DATATEST,DISP=SHR
// DD *
.
QUIT
/*
//*

Attachment text is present in the file *******.APPL.DATATEST
*******.APPL.DATATEST has LRECL as 80

What could be the reason behind the empty attachment file?

Re: Sending mail with attachment from JCL

PostPosted: Tue Jan 17, 2012 7:55 pm
by Ed Goodman
You are going to get yelled at for asking this question. I think the answer in your case is that you don't have a boundary at the end. I have also never use a boundary that contains a space.

Re: Sending mail with attachment from JCL

PostPosted: Tue Jan 17, 2012 8:41 pm
by Anup Garude
Thanks Ed.
I tried a lot and also gone thorugh various threads on this forum as well as other forums for the same, but still attachment file is being received as empty only iin the mail.
Even my earlier PS containing attchment file text has boundary at the end like

<text>
--simple boundary

Re: Sending mail with attachment from JCL

PostPosted: Tue Jan 17, 2012 8:59 pm
by Robert Sample
Depending upon the email client, it may not be possible to send plain text as an attachment -- some of the email systems I use will move the data into the body of the email even though I explicitly attach it as a file.

Re: Sending mail with attachment from JCL

PostPosted: Wed Jan 18, 2012 3:28 pm
by Anuj Dhawan
Anup Garude wrote:I am trying to send mail vai JCL using SMTP. I am receiving mail with attachment as well. However, attachment is empty.
Said that, do you get the "data" in the 'body of the mail'?

Re: Sending mail with attachment from JCL

PostPosted: Wed Jan 18, 2012 8:27 pm
by Anup Garude
yes, i am getting text in the body of the mail as well as attchment also. But attchment is empty.

Re: Sending mail with attachment from JCL

PostPosted: Wed Feb 15, 2012 4:04 pm
by Anuj Dhawan
I kept away from this Forum for a while - is it working now?

Re: Sending mail with attachment from JCL

PostPosted: Fri Mar 14, 2014 1:13 am
by ITguy54
Can anyone please tell me where I can find documentation about this process? I have Googled IEBGENER, IEBGENER SMTP, IEBGENER email and I cannot find anything to explain the parameters like HELO. What is the field after HELO supposed to represent? Thanks.

Re: Sending mail with attachment from JCL

PostPosted: Fri Mar 14, 2014 2:16 am
by MrSpock
SMTP is in the z/OS Comm Svr: IP User's Guide and Commands manuals:

http://publibfp.dhe.ibm.com/cgi-bin/boo ... /CCONTENTS

You also might want to read up on the internet protocol standards for SMTP

and this website has some good information

http://www.planetmvs.com/mvsmail/

Re: Sending mail with attachment from JCL

PostPosted: Fri Mar 14, 2014 5:42 am
by Robert Sample
Depending upon your precise requirements, you might need to look at the MIME standards as well. Start by looking at RFC 2821 (Google will find it).

Note that often you MUST consult with your site support group for assistance -- for example, the name used after the HELO command depends upon your site and only someone working at your site can tell you what to use.