Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sending an email attachment via JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Wed May 30, 2012 12:07 am    Post subject: Sending an email attachment via JCL
Reply with quote

Hi,
Trying to execute the below code, but i am not getting any attachment. Instead, what i am trying to attach is coming in email body itself.
Plese help:

//PWSTEP03 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTPT)
//SYSUT1 DD DISP=SHR,DSN=USSERID.TEST.EMAIL1
// DD DISP=SHR,DSN=USERID.TEST.EMAIL
//
/*

USSERID.TEST.EMAIL1 consists of:

HELO JOBTRAC
MAIL FROM:<XYZ@XYZ.COM>
RCPT TO :XYZ@XYZ.COM
DATA
FROM: XYZ@XYZ.COM
TO: XYZ@XYZ.COM
SUBJECT: JOB COMPLETED (SEE ATTACHMENT)
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME="XYZZ.TXT"


USERID.TEST.EMAIL consits of the attachment.

Both the files have same DCB parametres.

thanks for the help.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 30, 2012 12:37 am    Post subject:
Reply with quote

start with the links provided in this thread

if that does not answer your question, you can always search the jcl forum with a search key of: email + attachement
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 30, 2012 2:51 am    Post subject:
Reply with quote

Hello,

You have included the "attachment" as part of the actual e-mail text. . .
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Wed May 30, 2012 6:36 pm    Post subject: Reply to: Sending an email attachment via JCL
Reply with quote

Thanks Dick.

Then how to include the attachment..i dont want to include it in email text..

Regards,
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 30, 2012 6:50 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
start with the links provided in this thread

if that does not answer your question, you can always search the jcl forum with a search key of: email + attachement


i re-quote my earlier comment, since you seem to have missed it,
since i directly do not provide the control cards you need,
and you obviously have to dig for the answer yourself.

or, do you feel that we should just waste space repeating
what has be posted in other forums
and/or
what the manual/documentation provides?

am i missing something here?
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Wed May 30, 2012 6:59 pm    Post subject: Reply to: Sending an email attachment via JCL
Reply with quote

Hi Dick Brenholtz ,

Obviously you guys should not waste time in repeating the stuff and positng it again and again.

But i read your column and the chains that you provided. I did everything included the simple boundaries...changed my MIME command..but its not working. Moreover the threads that you provided too are not enough..as in that thread ultimately people are stuck with the same thing (not able to attach in emai) or they have been told to contact the email support group of their site.

As of now im stuck with this...and studing MIME...and trying to write/find the exact jcl code...
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed May 30, 2012 7:23 pm    Post subject:
Reply with quote

Tried from the suggested link. This works.

Code:
//STEP010  EXEC PGM=IEBGENER
//SYSIN    DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2   DD SYSOUT=B,DEST=SMTP
//SYSUT1   DD *
HELO JESNDIXA
MAIL FROM:<from-mail-id>
RCPT TO:<to-mail-id>
DATA
FROM: MAINFRAME
TO: to-mail-id
SUBJECT: TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
//         DD DISP=SHR,DSN=user-id.TEST.JCL(EMAILATT)
//         DD DISP=OLD,DSN=user-id.TEST.JCL(EMAILAT)
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed May 30, 2012 7:41 pm    Post subject:
Reply with quote

http://ibmmainframes.com/viewtopic.php?t=55814&highlight=email
http://ibmmainframes.com/viewtopic.php?t=57288&highlight=email
http://ibmmainframes.com/viewtopic.php?t=31751&highlight=email
http://ibmmainframes.com/viewtopic.php?t=50277&highlight=email
http://ibmmainframes.com/viewtopic.php?t=50150&highlight=email
http://ibmmainframes.com/viewtopic.php?t=48292&highlight=email
http://ibmmainframes.com/viewtopic.php?t=48602&highlight=email
http://ibmmainframes.com/viewtopic.php?t=47548&highlight=email
http://ibmmainframes.com/viewtopic.php?t=47397&highlight=email
http://ibmmainframes.com/viewtopic.php?t=47371&highlight=email
http://ibmmainframes.com/viewtopic.php?t=45383&highlight=email
Back to top
View user's profile Send private message
chhabraravneet

New User


Joined: 04 Oct 2007
Posts: 49
Location: Mumbai

PostPosted: Wed May 30, 2012 8:55 pm    Post subject: Reply to: Sending an email attachment via JCL
Reply with quote

Thanks a lot guys...for all your inputs...

i got it and it worked...

the last issue that i was facing was..my attachment file was coming from a sysprint..so if was always VBA and getting its own record length..
so i changed my control card to the same parametres as that of the attachment file that i was creating from the sysprint..ie kept all as VBA, same record lenght and same block size..and it worked..

thank you once again....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed May 30, 2012 10:18 pm    Post subject: Reply to: Sending an email attachment via JCL
Reply with quote

You're welcome - and thank you for the followup explaining your solution icon_smile.gif

d
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Wed Jun 06, 2012 8:46 pm    Post subject:
Reply with quote

I'm seem to be getting an issue not covered off in any of the other posts. I can send a text e-mail fine, an e-mail with an attachment fine, and an e-mail with both...up to a point.

What happens when I try and send text in the e-mail plus an attachment is that I lose all the line breaks in the body text so the resultant e-mail is just one line.

Any ideas? Are any special control characters required? The MIME docs that I have read talk about CRLF to start a new line which is x'0D0A' in ASCII but I don't know what would be required on the mainframe.
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Tue Jun 12, 2012 7:11 pm    Post subject:
Reply with quote

Further reading tells me that x'0A' in ASCII maps to x'25' in EBCDIC, so that implies that x'0D25' should do the trick, but it's still no good.

I've tried every combination of x'0A', x'0D' and x'25' that I can think of, without any success.

Any suggestions?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7912
Location: Bellevue, IA

PostPosted: Tue Jun 12, 2012 7:36 pm    Post subject:
Reply with quote

From RFC 2821:
Quote:
2.3.7 Lines

SMTP commands and, unless altered by a service extension, message
data, are transmitted in "lines". Lines consist of zero or more data
characters terminated by the sequence ASCII character "CR" (hex value
0D) followed immediately by ASCII character "LF" (hex value 0A).
This termination sequence is denoted as <CRLF> in this document.
Conforming implementations MUST NOT recognize or generate any other
character or character sequence as a line terminator. Limits MAY be
imposed on line lengths by servers (see section 4.5.3).

In addition, the appearance of "bare" "CR" or "LF" characters in text
(i.e., either without the other) has a long history of causing
problems in mail implementations and applications that use the mail
system as a tool. SMTP client implementations MUST NOT transmit
these characters except when they are intended as line terminators
and then MUST, as indicated above, transmit them only as a <CRLF>
sequence.
In other words, unless your mail client supports use of some specific character sequence to work as a line termination sequence, you cannot specify line terminators in an email. I haven't researched what the "service extension" could be -- and even if that has an answer to your problem, you'd have to worry about every link in the message handling that service extension the same way.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Jun 12, 2012 7:39 pm    Post subject:
Reply with quote

David - have you had a chance to look at this thread: http://ibmmainframes.com/viewtopic.php?t=50277&highlight=email

Also, suggest you please show us the JCL you've used. SMTP with MIME gets very picky about syntax at times.
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 175
Location: UK

PostPosted: Wed Jun 13, 2012 7:16 pm    Post subject:
Reply with quote

I have managed to resolve this now, and it was nothing to do with having a <CRLF> string. As others have said, MIME is very sensitive to positions, blank lines, etc., and although my original job was identical to an example posted here, for some reason it didn't work.

I've just tried various other examples on a trial and error basis and found one that worked fine (thanks to Robert's JCL on the link that Anuj provided).

Many thanks to everyone for your help and suggestions.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jun 13, 2012 7:50 pm    Post subject:
Reply with quote

Thanks for the feedback. Yes, Robert is one of the excellent contributors on this board.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts How to sending system service request... lind sh IMS DB/DC 5 Sun Apr 10, 2016 12:02 am
No new posts How to send email with Rich Text usin... santhosh5983 JCL & VSAM 4 Fri Apr 08, 2016 2:30 am
No new posts Issue in sending zip file as mail att... ajithajt JCL & VSAM 8 Thu Apr 07, 2016 9:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us