Page 1 of 1

How to Email multiple attachments using MIME

PostPosted: Wed Mar 31, 2010 6:25 pm
by amit1984
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

Re: How to Email multiple attachments using MIME

PostPosted: Wed Mar 31, 2010 6:46 pm
by Robert Sample
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.

Re: How to Email multiple attachments using MIME

PostPosted: Thu Apr 01, 2010 10:30 am
by amit1984
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=*

Re: How to Email multiple attachments using MIME

PostPosted: Thu Apr 01, 2010 10:33 am
by amit1984
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

Re: How to Email multiple attachments using MIME

PostPosted: Thu Apr 01, 2010 10:41 am
by dick scherrer
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".