View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi All,
I am trying to send an attachment (in .csv) format from mainframe to my outlook using SMTP. I am currently using the following code to deliver the mail.
Code: |
//SENDNOTE EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSABEND DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=B,DEST=(MVS1,TCPSMTP)
//SYSUT1 DD DSN=PRDCTN.MAIL.PROTOCOL,DISP=SHR
// DD DSN=PRDCTN.LOG.D100723.CSV,DISP=SHR
//*
|
PRDCTN.LOG.D100723.CSV is the file that is being sent as the attachment.
PRDCTN.MAIL.PROTOCOL contains the following details:
Code: |
HELO MVS4.VISA.COM
MAIL FROM: <aaa@zzz.COM>
RCPT TO: <BBB@ZZZ.COM>
DATA
SUBJECT: PMV ONCALL PRODUCTION LOG - 07/23/2010
FROM: <AAA@ZZZ.COM>
TO: <BBB@ZZZ.COM>
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN;
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=PROD_LOG.CSV
CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN;CHARSET="US-ASCII"
CONTENT-TRANSFER-ENCODING: 7BIT
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--
--SIMPLE BOUNDARY--
CONTENT-TYPE: APPLICATION/OCTET-STREAM;
|
My problem is I am getting the attachment with the subject only. But no details is getting populated in the mail body.
It would be of great help if any one can help me in this regards. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Why do you have two --SIMPLE BOUNDARY-- statements in a row? Each SIMPLE BOUNDARY delimits a body part so you are sending at least one completely empty attachment. |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
I removed one ---SIMPLE BOUNDARY-- statement. The result is the same i.e. only attachment and no email body |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I'm looking closer at your SMTP and I have no idea what you think you are doing with this -- but I'm confident that it won't produce what you think it will. These commands have been proven to produce two attachments in an email received by Microsoft Outlook on a PC (as well as by AOL):
Code: |
HELO MAINFRAME.xxx.com
MAIL FROM: <aaa@bbb.COM>
RCPT TO: <ccc@ddd.COM>
DATA
FROM: MAINFRAME
TO: <whoever>
SUBJECT: ATTACHMENTS
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILATT.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILATT)
// DD *
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILTST.TXT
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILTST)
// DD *
--SIMPLE BOUNDARY--
// DD DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILAT) |
File TTSSRS0.JCL.CNTL member EMAILATT is created as EMAILATT.TXT for attachment 1 -- where is the DD statement pointing to your file that you're wanting to attach? File TTSSRS0.JCL.CNTL member EMAILTST is created as EMAILTST.TXT for attachment 2. After your APPLICATION: OCTET-STREAM you need a DD statement pointing to whatever you want to attach. Furthermore, you will need a SIMPLE BOUNDARY after that attachment before the trailing period.
Finally, it is not clear from what you've posted -- do you have the trailing period in the SMTP commands? |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
My simple requirement is I have to send one attachment (DD DSN= PRDCTN.LOG.D100723.CSV,DISP=SHR) with the below mail body:
This e-mail (including attachments) is confidential and legally
privileged and is intended solely for the addressee.
Thank you for your help
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.
Now, my problem is: I am able to send the attachment but the mail body is not generated i.e. I am getting an e-mail with the attachment, FROM Name and Subject line. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
My simple requirement is I have to send one attachment (DD DSN= PRDCTN.LOG.D100723.CSV,DISP=SHR) with the below mail body: |
Sadly, requirements cannot always be met. This appears to be one of those cases. SMTP with MIME tends to get very picky about syntax and everything must be just right for the email to be sent. I've managed to get the inline text and the attachment generated, but there are extra attachments that I have not been able to get rid of. The latest attempt I made is:
Code: |
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> |
|
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi Robert,
I used the below mentioned code to successfully generate the mail as per my requirement:
Code: |
SUBJECT: PMV Oncall Production Log - $MM/$DD/$YYYY
MIME-VERSION: 1.0<br>
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY=MIMEBOUNDARY
--MIMEBOUNDARY
CONTENT-TYPE: TEXT/HTML
</I></FONT></CENTER><BR><FONT SIZE=3 FACE=CALIBRI>
This is an automated message generated from the MVS Job XXXXXXXX
at MVS4plex to notify the user about the details comprising of start
time, end time, execution time and various other counts of AAAAAAAA,
BBBBBBBB and CCCCCCCC job for the odate $MM$DD herewith the mail.
<BR>
</FONT><FONT SIZE=3 FACE=CALIBRI>
<BR>
For more info, please contact <B>TEAM NAME</B>.
<BR><LEFT> TEAM SIGNATURE
</FONT></LEFT>
<BR><BIG><CENTER><FACE=CALIBRI>
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.
Unless it is addressed to you, you may not read, copy, use or store it
in any way, or permit others to.
Thank you for your help
--MIMEBOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=Prod_Log.csv
/*
// DD DSN=<FILE ATTACHMENT>
// DD *
.
/*
//*
|
Thanks for your help. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear it worked! |
|
Back to top |
|
|
|