IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SMTP Email - body with an attachment question


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
higherbriars

New User


Joined: 24 Jan 2007
Posts: 13
Location: SLC

PostPosted: Thu Aug 25, 2011 4:29 am
Reply with quote

I've looked through several of the SMTP posts for an answer to my question, and I hate to bother you guy's, but...
I can send text in the body of an email, no problem. I can also send an attachment, no problem I'd like to do both, but when I execute the following JCL, I only receive the body. If I remove the first dataset, I lose the body and I receive the email with a subject and the attachment. Anyone have a suggestion as to what I might be doing wrong? Thank you.



Code:
//STEP01 EXEC PGM=IEBGENER                               
//SYSIN    DD DUMMY                                   
//SYSPRINT DD SYSOUT=*                                     
//SYSUT2   DD SYSOUT=(B,SMTP),                             
//            DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0)           
//SYSUT1   DD *                                             
HELO XXXX                                                   
MAIL FROM:    <xxxx.x.xxxx@xxx.com>                     
RCPT TO:      <xxxx.x.xxxx@xxx.com>                     
DATA                                                       
FROM:         xxxxxxxx                       
SUBJECT:      Attachment not coming thru on SMTP Email test?
/*                                                           
//         DD DSN=xxxx.xxx.xxxxxxxx.xxxx.BODYTXT, 
//            DISP=SHR 
//         DD *                                   
MIME-VERSION: 1.0                                           
CONTENT-TYPE: TEXT/PLAIN                                   
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=REPORT01.TXT
/*                                                         
//         DD DSN=xxxx.xxx.xxxxxxx.xxxx.REPORT01,           
//            DISP=SHR                                                 
//*
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Aug 25, 2011 5:05 am
Reply with quote

How about you change your job and write the contents of SYSUT2 to a dataset, and then post that entire content here (please use the CODE BBI tags when you do)?
Back to top
View user's profile Send private message
higherbriars

New User


Joined: 24 Jan 2007
Posts: 13
Location: SLC

PostPosted: Thu Aug 25, 2011 5:49 am
Reply with quote

There's not much to see...
The sysin data is terminating before it makes it to the attachment so you're not going to see it in a cataloged SYSUT2.
I get the body of the email (contained in the first file), but I don't get the attachment file.

SYSUT2


Code:

HELO XXXX                                                   
MAIL FROM:    <xxxx.x.xxxxxxx@xxx.com>                       
RCPT TO:      <xxxx.xxxx@xxx.com>                       
DATA                                                         
FROM:         xxxx                         
SUBJECT:      Attachment not coming thru on SMTP Email test?
                                                             
 Attention Programmer, et. all -                             
 Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 below one of the programmer-specified thresholds.   
     EMAIL THRESHOLD:  99 %                                 
     ABEND THRESHOLD:                                       
 Before continuing ....., so on, so forth.
 Please see the attached file and do a FIND on the following text:
 "ORIGINAL aaaaaaaa aaaaaaaaa aaaaa aaaaa aaaaa"
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 This error indicates that there is something wrong with the.....
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 


Thanks,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 25, 2011 6:00 am
Reply with quote

IIRC, I don't think you've got enough MIME parts defined to allow for a body and attachment. I'm not able to get to my mainframe files right this minute, but I'll look when I get a chance for what's worked for me in the past.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Aug 25, 2011 6:16 am
Reply with quote

higherbriars, where's the MIME code with the envelope surrounding the data?
Back to top
View user's profile Send private message
higherbriars

New User


Joined: 24 Jan 2007
Posts: 13
Location: SLC

PostPosted: Thu Aug 25, 2011 6:17 am
Reply with quote

That'd be great.
Thanks.
Back to top
View user's profile Send private message
higherbriars

New User


Joined: 24 Jan 2007
Posts: 13
Location: SLC

PostPosted: Thu Aug 25, 2011 6:28 am
Reply with quote

superk, my first post is the jcl i'm executing, with the MIME commands just prior to the file i'd like to attach. we're changing from rightfax to smtpeml. i wrote my jcl based on the examples that were distributed...actually, not knowing any better, i'm trying to combine 2 of the examples into 1 email step (body + attachment) as i had done with rightfax. are you saying i'm missing some MIME and need to hit the manuals harder?
thanks,
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu Aug 25, 2011 10:58 am
Reply with quote

Try this...

Code:
//STEP01 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=ABC.DEF.HEADER1,DISP=SHR
// DD DSN=ABC.DEF.FILE1,DISP=SHR
// DD DSN=ABC.DEF.HEADER2,DISP=SHR
// DD DSN=ABC.DEF.FILE2,DISP=SHR

This is HEADER1...
HELO XXXXXX
MAIL FROM:<XXXX@xxxxxxxxxxx>
RCPT TO:<XXXX@xxxxxxxxxxx>
DATA
SUBJECT: TEST REPORT ATTACHMENTS (FILE1 AND FILE2)
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED;BOUNDARY="MIME.PART"
<blank line>
--MIME.PART
<blank line>
--MIME.PART
CONTENT-TYPE: MULTIPART/MIXED;NAME="FILE1.TXT"
<blank line>

This is HEADER2...
--MIME.PART
CONTENT-TYPE: MULTIPART/MIXED; NAME="FILE2.TXT"
<blank line>

.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 25, 2011 5:01 pm
Reply with quote

This JCL produces an email body and attachment:
Code:
//MAILPROC EXEC PGM=IEBGENER
//SYSABEND DD   SYSOUT=*
//SYSTOTAL DD   SYSOUT=*
//SYSLIST  DD   SYSOUT=*
//SYSPRINT DD   SYSOUT=*
//SYSUT2   DD   SYSOUT=(<wc>,<smtptask>)
//SYSIN    DD   DUMMY
//*
//SYSUT1   DD   *
HELO <yoursystem>
MAIL FROM: <desired.name@demain.whatever>
RCPT TO: <email.recipient@domain.whatever>
DATA
SUBJECT: SUBJECT LINE
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/HTML

<<this is where the body of the email goes>>

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

//         DD   DISP=SHR,DSN=<attachment data set>
//         DD   DISP=SHR,DSN=<ending period>
You will have to customize, to your site standards, these fields:
<wc> -- writer class (usually B but could be any letter or number)
<smtptask> -- SMTP started task name (often but not always SMTP)
<yoursystem> -- system id
sending email address
receiving email address
attachment data set
data set name with ending period required for SMTP emails
and of course change the body of the email as desired.
Back to top
View user's profile Send private message
higherbriars

New User


Joined: 24 Jan 2007
Posts: 13
Location: SLC

PostPosted: Fri Aug 26, 2011 1:23 am
Reply with quote

Thanks for your input everyone. You got me going in the right direction... I was able to write the body of the email from a file AND include an attachment. I did not need to provide the single period that you had in your examples.



Body from a file with an attachment

Code:
 //********************************************************************
//* ZOS SMTP EXAMPLE:                                                 
//*   1.  BODY OF EMAIL IS WRITTEN FROM A FILE.                       
//*   2.  INCLUDE A REPORT FILE ATTACHMENT.                           
//********************************************************************
//STEPXYZ  EXEC PGM=IEBGENER                                         
//SYSPRINT DD   SYSOUT=*                                             
//SYSIN    DD DUMMY                                                   
//SYSOUT   DD SYSOUT=*                                               
//SYSPRINT DD SYSOUT=*                                               
//SYSUT2   DD SYSOUT=(B,SMTP),                                       
//            DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0)                     
//SYSUT1   DD *                                                       
HELO ????                                                             
MAIL FROM:    <????.?.???????@???.COM>                               
RCPT TO:      <????.?.???????@???.COM>                               
DATA                                                                 
FROM:         ????.?.???????@???.COM                                 
SUBJECT:      SMTP Email test / Body from a file + an attachment         
MIME-VERSION: 1.0                                                     
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"             
                                                                     
--SIMPLE BOUNDARY                                                 
CONTENT-TYPE: TEXT/PLAIN                                           
                                                                   
//         DD DSN=XXXX.XXX.XXXXXXX.XXXX.XXXX,    BODY OF EMAIL     
//            DISP=SHR                                             
//         DD *                                                   
--SIMPLE BOUNDARY                                                 
CONTENT-TYPE: TEXT/PLAIN                                           
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=REPORT.TXT               
                                                                   
//         DD DSN=XXXX.XXX.XXXXXXX.XXXX.XXXXX,   REPORT ATTACHMENT
//            DISP=SHR                                             
/*                                                                 
//*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts mail attachment with excel format All Other Mainframe Topics 2
No new posts REXX to send an email in Mainframe wi... CLIST & REXX 3
No new posts REXX to send an email in Mainframe CLIST & REXX 4
Search our Forums:

Back to Top