Sending mail with attachment from JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Sending mail with attachment from JCL

Postby Anup Garude » Tue Jan 17, 2012 1:52 pm

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?
Anup Garude
 
Posts: 3
Joined: Tue Jan 17, 2012 12:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending mail with attachment from JCL

Postby Ed Goodman » Tue Jan 17, 2012 7:55 pm

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.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Sending mail with attachment from JCL

Postby Anup Garude » Tue Jan 17, 2012 8:41 pm

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
Anup Garude
 
Posts: 3
Joined: Tue Jan 17, 2012 12:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending mail with attachment from JCL

Postby Robert Sample » Tue Jan 17, 2012 8:59 pm

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Sending mail with attachment from JCL

Postby Anuj Dhawan » Wed Jan 18, 2012 3:28 pm

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'?
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Sending mail with attachment from JCL

Postby Anup Garude » Wed Jan 18, 2012 8:27 pm

yes, i am getting text in the body of the mail as well as attchment also. But attchment is empty.
Anup Garude
 
Posts: 3
Joined: Tue Jan 17, 2012 12:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending mail with attachment from JCL

Postby Anuj Dhawan » Wed Feb 15, 2012 4:04 pm

I kept away from this Forum for a while - is it working now?
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

Re: Sending mail with attachment from JCL

Postby ITguy54 » Fri Mar 14, 2014 1:13 am

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.
ITguy54
 
Posts: 2
Joined: Thu Mar 13, 2014 9:10 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sending mail with attachment from JCL

Postby MrSpock » Fri Mar 14, 2014 2:16 am

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/
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Sending mail with attachment from JCL

Postby Robert Sample » Fri Mar 14, 2014 5:42 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post