View previous topic :: View next topic
|
Author |
Message |
higherbriars
New User
Joined: 24 Jan 2007 Posts: 13 Location: SLC
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
higherbriars
New User
Joined: 24 Jan 2007 Posts: 13 Location: SLC
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
higherbriars, where's the MIME code with the envelope surrounding the data? |
|
Back to top |
|
|
higherbriars
New User
Joined: 24 Jan 2007 Posts: 13 Location: SLC
|
|
|
|
That'd be great.
Thanks. |
|
Back to top |
|
|
higherbriars
New User
Joined: 24 Jan 2007 Posts: 13 Location: SLC
|
|
|
|
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 |
|
|
gylbharat
Active Member
Joined: 31 Jul 2009 Posts: 565 Location: Bangalore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
higherbriars
New User
Joined: 24 Jan 2007 Posts: 13 Location: SLC
|
|
|
|
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 |
|
|
|