Email an attachment



Post anything related to mainframes (IBM & UNISYS) if not fit in any of the above categories

Email an attachment

Postby Srini Srini » Sat Jun 18, 2011 1:13 pm

Hello,

I am trying to email an attachment from mainframe using IEBGENER. My JCL is:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD SYSOUT=*
//SYSTOTAL DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(A,SMTP)
//SYSIN DD DUMMY
//*
//SYSUT1 DD DSN=USERID.INPUT.CARDS,DISP=SHR
// DD DSN=USERID.DCOL.DATASETS,DISP=SHR

Content of USERID.INPUT.CARDS is as below:

HELO MAILST1
MAIL FROM: <NAME@COMPANY.COM>
RCPT TO: <NAME@COMPANY.COM>
DATA
FROM: <NAME@COMPANY.COM>
TO: <NAME@COMPANY.COM>
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-DISPOSITION:ATTACHMENT;FILENAME="TEXT_FILE.TXT"
CONTENT-TYPE: TEXT/PLAIN

This JCL is working well, but if I put some text in the body of the USERID.INPUT.CARDS, I don't get the attachment, instead I get the attachment text in the body of the email.

Any help on getting this work, please?

Thanks,
Srini
Srini Srini
 
Posts: 28
Joined: Sun May 30, 2010 10:50 am
Has thanked: 0 time
Been thanked: 0 time

Re: IEBGENER - jcl to email an attachment

Postby NicC » Sat Jun 18, 2011 2:48 pm

Have you found anything in the forum to help you? There are many posts re e-mailing attachments - you should find your answer there.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: IEBGENER - jcl to email an attachment

Postby Robert Sample » Sat Jun 18, 2011 6:27 pm

This JCL is working well, but if I put some text in the body of the USERID.INPUT.CARDS, I don't get the attachment, instead I get the attachment text in the body of the email.

Any help on getting this work, please?
What you are seeing is how this form of email attachment works. If there is any text added to the body, the attachment is not going to be attached but rather it will be included in the body of the email. That is the way it works.

The commands below have been used to send an email with text in the body and an attachment:
HELO MAINFRAME
MAIL FROM: <MAINFRAME@xxx.COM>
RCPT TO: <aaa@xxx.COM>
DATA
SUBJECT: PMV ONCALL PRODUCTION LOG - 07/23/2010
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: INLINE

NOTICE
</BIG></FONT><BR><FONT SIZE=2 FACE=CALIBRI COLOR=RED><I>
THIS E-MAIL (INCLUDING ATTACHMENTS) IS CONFIDENTIAL AND LEGALLY
PRIVILEGED AND IS INTENDED SOLELY FOR THE ADDRESSEE.
THANK YOU FOR YOUR HELP
</I></FONT></CENTER><BR><FONT SIZE=3 FACE=CALIBRI>
THIS IS AN AUTOMATED MESSAGE GENERATED FROM THE MVS JOB XXXXXX
AT ZZZZZZ TO NOTIFY THE USER ABOUT THE DETAILS OF THE PRODUCTION LOG
FOR DIFFERENT JOBS THAT HAVE EXECUTED OVER THE DAY.
<BR><BR>

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=PROD_LOG.CSV

//         DD   DISP=SHR,DSN=<file to be attached>
//         DD   DISP=SHR,DSN=<trailing period file>
Note that SMTP MIME is extremely sensitive to the precise format of the data, and even omitting on the the blank lines may cause the email to not be sent or the attachment to not be included.
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: email an attachment

Postby Srini Srini » Sun Jun 19, 2011 1:12 am

Thanks Robert/Nic, its working now!

- Srini
Srini Srini
 
Posts: 28
Joined: Sun May 30, 2010 10:50 am
Has thanked: 0 time
Been thanked: 0 time

Re: email an attachment

Postby Robert Sample » Sun Jun 19, 2011 2:31 am

Good to hear!
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: email an attachment

Postby mallarapumnaidu » Tue Apr 10, 2012 3:24 pm

//abcdedgh JOB (xxxxxxx),'Testmail',
//         CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*---------------------------------------------------
//STEPMX05 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=D
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD DSN=test.EMAIL.ATTACH.CARD,DISP=SHR
// DD DSN=test.EMAIL.ATTACH.CARD1,DISP=SHR
// DD DSN=test.EMAIL.ATTACH.CARD2,DISP=SHR

test.EMAIL.ATTACH.CARD has below information

HELO DCHA
MAIL FROM: <abcd@test.COM>
RCPT TO: <abcd@test.COM>
DATA
FROM: abcd@test.COM
TO: abcd@test.COM
SUBJECT: test fiel.
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: INLINE
NOTICE
</BIG></FONT><BR><FONT SIZE=2 FACE=CALIBRI COLOR=RED><I>
THIS E-MAIL (INCLUDING ATTACHMENTS) IS CONFIDENTIAL AND LEGALLY
PRIVILEGED AND IS INTENDED SOLELY FOR THE ADDRESSEE.
THANK YOU FOR YOUR HELP
</I></FONT></CENTER><BR><FONT SIZE=3 FACE=CALIBRI>
THIS IS AN AUTOMATED MESSAGE GENERATED FROM THE MVS JOB XXXXXX
AT ZZZZZZ TO NOTIFY THE USER ABOUT THE DETAILS OF THE PRODUCTION LOG
FOR DIFFERENT JOBS THAT HAVE EXECUTED OVER THE DAY.
<BR><BR>
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=PROD_LOG.CSV




and test.EMAIL.ATTACH.CARD1 has data to be sent as attachment.



test.EMAIL.ATTACH.CARD2 has

.

My job ran with out any error but i received email but data came as body of email not as attachment.

Even subject is blank.

Please suggest if any changes required in JCL/email card.
mallarapumnaidu
 
Posts: 5
Joined: Tue May 12, 2009 10:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: email an attachment

Postby Robert Sample » Tue Apr 10, 2012 4:47 pm

Did you bother doing a search on the other forum you posted the same thing in? If so, you would have found any number of posts that have JCL that generate email attachments, and several discussions about the requirements of SMTP to genrate attachments.
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: email an attachment

Postby mallarapumnaidu » Tue Apr 10, 2012 5:15 pm

We tried all possible solutions provided on forums.. its not working for me please review my script and help me ...
mallarapumnaidu
 
Posts: 5
Joined: Tue May 12, 2009 10:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: email an attachment

Postby Robert Sample » Tue Apr 10, 2012 5:26 pm

Your search ability needs to be improved, then. I easily and rapidly found on the other forum http://ibmmainframes.com/about55814.html which has a JCL sample that I used to generate an email with attachment and body. You can modify it to meet your needs.
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: email an attachment

Postby mallarapumnaidu » Wed Apr 11, 2012 12:29 pm

//abcdTEST JOB (xxx),'test file',
//         CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*---------------------------------------------------
//STEP01S  EXEC PGM=IEBGENER
//SYSOUT   DD SYSOUT=*
//SYSLIST  DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2   DD SYSOUT=(B,SMTP),
//*            DCB=(RECFM=FBA,LRECL=267,BLKSIZE=0)
//SYSIN    DD DUMMY
/*
//SYSUT1   DD DSN=abcd.TEST.EMLLIST2,DISP=SHR
//         DD DSN=abcdEMIAL.TEST.ATTCH,DISP=SHR
//         DD DSN=abcd.TEST.EMLLIST3,DISP=SHR


abcd.TEST.EMLLIST2 has below information

HELO DCHA
MAIL FROM: <test@abcd.COM>
RCPT TO: <test@abcd.COM>
DATA
SUBJECT: test FILE
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
NAD FILE TO SFDC
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=NAD_FILE.CSV


abcd.TEST.EMLLIST3 has a . in it
I am still not able to send attachment i tired using you code given in
http://ibmmainframes.com/about55814.html
I am receiving mail with attachment file data in Body with out subject
Please help me..
mallarapumnaidu
 
Posts: 5
Joined: Tue May 12, 2009 10:47 am
Has thanked: 0 time
Been thanked: 0 time

Next

Return to All other Mainframe Topics

 


  • Related topics
    Replies
    Views
    Last post