How to Email multiple attachments using MIME



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

How to Email multiple attachments using MIME

Postby amit1984 » Wed Mar 31, 2010 6:25 pm

I want to mail 2 FB files using SMTP/MIME in a single step. XMITIP is not installed in our system. Currently the code that I have is as follows :-

Code:

//SENDMAIL EXEC     PGM=IEBGENER
//SYSIN    DD  DUMMY
//SYSUT1   DD  DSN=CS.CI#J08.SASLIB3(BODYMAIL),DISP=SHR
//         DD  DSN=CS.CI#J08.PROP.SURVEY.ELEC.ACCNTS,DISP=SHR
//         DD   *
--SIMPLE BOUNDARY
//         DD  DSN=CS.CI#J08.SASLIB3(BDYMAIL),DISP=SHR
//         DD   *
 
--SIMPLE BOUNDARY
//         DD  DSN=CS.CI#J08.PROP.SURVEY.GAS.ACCNTS,DISP=SHR
//SYSUT2   DD  SYSOUT=(B,SMTP)
//SYSIN    DD  DUMMY
//SYSPRINT DD  SYSOUT=*
//SYSPRINT DD  SYSOUT=*
//





The contents of MAIL and MAIL1 are as follows

MAIL
Code:

HELO PRD370
MAIL FROM:<XX@XX.COM>
RCPT TO:<XX@YY.COM>
DATA
SUBJECT: Hello
TO:XX@YY.com
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-TRANSFER-ENCODING: QUOTED-PRINTABLE
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=ACCTS.CSV



MAIL1
Code:

MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
---SIMPLE BOUNDARY
CONTENT-TRANSFER-ENCODING: QUOTED-PRINTABLE
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=ACCTS1.CSV


This works for me and is generating two attachments. I am getting the data of first file in the first attachment correctly but the second attachment is coming blank. I am not getting any data in that.

I think I am missing some ---SIMPLE BOUNDARY or am having some fault in that.
Can anyone help me out.

Amit
amit1984
 
Posts: 3
Joined: Wed Mar 31, 2010 10:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to Email multiple attachments using MIME

 

Re: How to Email multiple attachments using MIME

Postby Robert Sample » Wed Mar 31, 2010 6:46 pm

You talk about MAIL and MAIL1 but I don't see either in your JCL. And using the Code button helps show exactly what you do have.

I strongly recommend you start by doing everything inline as a test. Once you've got it working with inline data, then you can start breaking things up the way your JCL is. But until you've done it with inline data, there's too many places things can be messed up to know for sure where the error is.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: How to Email multiple attachments using MIME

Postby amit1984 » Thu Apr 01, 2010 10:30 am

Hi Robert,
First of all Thanks for your reply...

The correct JCL is :-


//SENDMAIL EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT1 DD DSN=XX.JJ(MAIL),DISP=SHR
// DD DSN=XX.ACCNTS,DISP=SHR
// DD DSN=XX.JJ(MAIL1),DISP=SHR
// DD DSN=XX.ACCNTS1,DISP=SHR
//SYSUT2 DD SYSOUT=(B,SMTP),DCB=(LRECL=137)
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
amit1984
 
Posts: 3
Joined: Wed Mar 31, 2010 10:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to Email multiple attachments using MIME

Postby amit1984 » Thu Apr 01, 2010 10:33 am

I have been testing it inline but am not getting where exactly the problem is...

Just to give you a better idea as to what is happening...

Thanx
Amit
amit1984
 
Posts: 3
Joined: Wed Mar 31, 2010 10:33 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to Email multiple attachments using MIME

Postby dick scherrer » Thu Apr 01, 2010 10:41 am

Hello,

What you have posted is not running the test inline as suggested by Robert. . .

Everything that is the sysut1 dataset needs to be in one or more sets of DD * data (not some dasd files) to be "inline".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post