Page 1 of 1

SMTP output stuck in Output Queue

PostPosted: Thu Dec 11, 2014 5:05 pm
by deucalion0
I have been trying for days to send email via SMTP and JCL.

I believe my JCL is free of errors:

//SMTP      EXEC PGM=IEBGENER                               
//SYSPRINT  DD SYSOUT=*                                     
//SYSIN     DD DUMMY,DCB=BLKSIZE=80                         
//SYSUT2    DD SYSOUT=(B,SMTP)                               
//SYSUT1    DD *                                             
HELO NODENAME                                               
MAIL FROM:<EMAIL@AA.COM>                                     
RCPT TO:<EMAIL@AA.COM>                                       
DATA                                                         
FROM:    <EMAIL@AA.COM>                                     
TO:      <EMAIL@AA.COM>                                     
SUBJECT:  TEST MESSAGE FROM MVS USING SMTP                   
MIME-Version: 1.0                                           
Content-type: multipart/mixed; boundary="SIMPLE BOUNDARY"   
THIS IS A TEST.                                             
--SIMPLE BOUNDARY                                           
QUIT                                                         
Please open the attachment, to solve your problems...       
--SIMPLE BOUNDARY                                           
Content-type: text/html                                     
Try Google<a href="http://www.google.com">GOOGLE</a>       
 --SIMPLE BOUNDARY--
 .                   
 QUIT               
 //                 


I have replaced the emails in the JCL with dud ones of course.

My job completes with RC0 of course, but the emails never come through. I checked the Output queue in SDSF and there my attempts are stuck. I can see the WTR is of course SMTP.

I looked in my SMTP started task and the class it uses is indeed B.

I have been researching this and I believe that something else needs to do some work here and grab my SMTP outputs from the output queue but nothing ever happens.

Is there something I could look into and maybe figure out what is going on here?

any advice is appreciated!

Thank you!

Re: SMTP output stuck in Output Queue

PostPosted: Thu Dec 11, 2014 5:22 pm
by Robert Sample
Have you tried to send a simple email -- no attachments, nothing but text? If not, you need to start with that. Your problem could be as simple as having line numbers in your JCL -- SMTP does not recognize nor can it deal with line numbers in columns 73 - 80, for example. With MIME on z/OS, it has been my experience that blank lines are mandatory between parts of the message and I'm not seeing them in your post.

You REALLY need your site support group to assist you in determining the problem. The SMTP temporary files probably have some indication of the problem but their names are entirely site dependent and hence only someone working at your site could help you with them.

Re: SMTP output stuck in Output Queue

PostPosted: Thu Dec 11, 2014 7:25 pm
by deucalion0
Hi Robert, thank you for your input.

I have not been able to find a simple and minimal SMTP email example which I can test with. I have look through manuals and Googled for days, and so far this is the best I have come up with.

Could you share a simple email message which I can try? I have tried a few other examples but they were more complicated and I felt like maybe copying and pasting was causing me problems.

I will keep on researching this and hopefully I can get this to work, as it is now frustrating me to hell.

Any further advice is appreciated and as always, thanks for your help Robert!

Re: SMTP output stuck in Output Queue

PostPosted: Thu Dec 11, 2014 7:40 pm
by steve-myers
Other possibilities are the SMTP task is not selecting output class B or the SMTP task is not operating at all. As Mr. Sample says, you MUST discuss this with your support.

I noticed in your example there is a blank before the // in your last line. If that is correct, the line is being sent to SMTP; it is not the end of the job. While it is unlikely that is the root cause of your problem, it could case problems in SMTP.

Re: SMTP output stuck in Output Queue

PostPosted: Thu Dec 11, 2014 8:50 pm
by Terry Heinze
Does your NULL statement (//) start in column 2 or is that a copy/paste error?

Re: SMTP output stuck in Output Queue

PostPosted: Fri Dec 12, 2014 4:29 am
by Robert Sample
HELO NODENAME                                               
MAIL FROM:<EMAIL@AA.COM>                                     
RCPT TO:<EMAIL@AA.COM>                                       
DATA                                                         
FROM:    <EMAIL@AA.COM>                                     
TO:      <EMAIL@AA.COM>                                     
SUBJECT:  TEST MESSAGE FROM MVS USING SMTP                   
test                                   
.
Copy this to your SMTP server and see if it goes -- if not, your site group may not have SMTP set up correctly and you would HAVE to get them involved. If you want to get simpler, leave out the FROM / TO / SUBJECT lines after the DATA line and just send the word "test" -- it should come through without a subject line.

Instead of using instream data, you might want to put your commands into a file (so you can be 100% certain there are no line numbers) and copy that file to SYSOUT=(B,SMTP) via IEBGENER.

And here are SMTP commands that I've used in the past to send MIME attachments:
HELO MAINFRAME
MAIL FROM: <MAINFRAME@URL.COM>
RCPT TO: <ROBERT.SAMPLE@URL.COM>
DATA
FROM:     MAINFRAME@URL.COM
TO:       ROBERT.SAMPLE@URL.COM
DATE:     DECEMBER 11, 2014
SUBJECT:  TEST ATTACHMENT
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILATT.TXT

//         DD   DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILATT)
//         DD   *
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=EMAILTST.TXT

//         DD   DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILTST)
//         DD   *
--SIMPLE BOUNDARY--
//         DD   DISP=SHR,DSN=TTSSRS0.JCL.CNTL(EMAILAT)
//
and the blank lines after the CONTENT-DISPOSITION lines are NOT optional -- the email won't go if they are missing. I am not sure what the mainframe will do with an HTML MIME part -- you should get pure TEXT attachments working before tackling anything else.