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

SMTP email through TDQ


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 30, 2011 7:51 pm
Reply with quote

I am writing to a TDQ that is allocated like the following:

Code:
 TDqueue        : SMTP
 Group          : MYGROUP
 DEscription    :
 TYPE           : Extra              Extra | INTra | INDirect
EXTRA PARTITION PARAMETERS
 DAtabuffers    : 001                1-255
 DDname         : MAIL
 DSname         :
 Sysoutclass    :
 Erroroption    : Ignore             Ignore | Skip
 Opentime       : Initial            Initial | Deferred
 REWind         :                    Leave | Reread
 TYPEFile       : Output             Input | Output | Rdback
 RECORDSize     : 00080              0-32767
 BLOCKSize      :                    0-32767
 RECORDFormat   : Fixed              Fixed | Variable
 BLOCKFormat    : Blocked            Blocked | Unblocked
 Printcontrol   :                    A | M
 DIsposition    : Shr                Shr | Old | Mod


This is how the MAIL DD is allocated:

Code:
//MAIL     DD  SYSOUT=(B,SMTP)


I write to the TDQ, my task ends, but the email does not send. I closed the TDQ, but it still does not send. The email is finally sent when the region is shut down.

This is what I am writing:

Code:
HELO MY.MAIL.SERVER.COM
MAIL FROM:<CICS@.MY.MAIL.SERVER.COM>
RCPT TO:<ME@MY.MAIL.SERVER.COM>
DATA
TO:   <ME@MY.MAIL.SERVER.COM>
FROM: <CICS@MY.MAIL.SERVER.COM>
SUBJECT:  TEST SMTP MESSAGES
THIS IS A TEST


I tried appending 'QUIT', but it just treated it like a string in the body of the email.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed Mar 30, 2011 8:02 pm
Reply with quote

Where's the period? And yes, you need QUIT as well.

See this example or read up on how to properly code for the SMTP protocol.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Wed Mar 30, 2011 8:11 pm
Reply with quote

Ok. Now my SMTP string looks like the following:

Code:
HELO MY.MAIL.SERVER.COM
MAIL FROM:<CICS@.MY.MAIL.SERVER.COM>
RCPT TO:<ME@MY.MAIL.SERVER.COM>
DATA
TO:   <ME@MY.MAIL.SERVER.COM>
FROM: <CICS@MY.MAIL.SERVER.COM>
SUBJECT:  TEST SMTP MESSAGES
THIS IS A TEST
.
QUIT


Still no luck...
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Mar 31, 2011 12:06 am
Reply with quote

Hello,

Are you sure that B,SMTP is the right SYSOUT destination?
There was a post few days back which has some information that might help.
www.ibmmainframes.com/viewtopic.php?t=53855&highlight=

Hope it helps.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 31, 2011 12:30 am
Reply with quote

Yes. My installation uses class B.

The issue is not that the mail is not being delivered. It is making it to the destination, just not when the transaction is being executed.
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 Mar 31, 2011 12:41 am
Reply with quote

Did you CLOSE the TDQ, or did you CLOSE & DISABLE the TDQ? If the first, I'd try doing both to see if that works. You may need FREE=CLOSE on the DD statement as well.

However, IBM's example of sending email to SMTP from CICS is CA1H (hint: Google is your friend) and CA1H uses the SPOOL commands, not a TDQ. I would consider this a very strong hint that TDQ is probably not the way to go when writing SMTP from CICS.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Thu Mar 31, 2011 1:18 am
Reply with quote

Robert Sample wrote:
Did you CLOSE the TDQ, or did you CLOSE & DISABLE the TDQ? If the first, I'd try doing both to see if that works. You may need FREE=CLOSE on the DD statement as well.

However, IBM's example of sending email to SMTP from CICS is CA1H (hint: Google is your friend) and CA1H uses the SPOOL commands, not a TDQ. I would consider this a very strong hint that TDQ is probably not the way to go when writing SMTP from CICS.


I tried all three. I first did a simple close, then close/disable, then later I freed the DD. All three failed to work.

I think I am in agreement with your last sentence. I don't think writing to a TDQ is a supported function for SMTP.

We talked about writing to the spool and creating a job to simply issue the SMTP commands, but that is very convoluted and would be irritating for someone in the future to come across.
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 Mar 31, 2011 1:22 am
Reply with quote

Quote:
but that is very convoluted
Why? IBM has already written the code in CA1H and it is available for download for free. They even have a sample calling program, written in COBOL, that is used to verify the installation. There's not much more than copying, compiling, and adding some CICS table entries to get that solution up and running.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Mar 31, 2011 1:37 am
Reply with quote

and what about understanding the solution ? icon_wink.gif

Quote:
but that is very convoluted and would be irritating for someone in the future to come across.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Tue Apr 05, 2011 5:30 am
Reply with quote

phew!, I don't understand why some programmers refuse to ask their
co-workers or their Tech Support people for help.

if your environment is setup to do SMTP email from CICS,
then someone in your shop most already know how to do this.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Tue Apr 05, 2011 5:33 am
Reply with quote

Earl Haigh wrote:
phew!, I don't understand why some programmers refuse to ask their co-workers or their Tech Support people for help.


The poster IS the CICS Systems Programmer.
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 7:51 am
Reply with quote

Robert Sample wrote:
Quote:
but that is very convoluted
Why? IBM has already written the code in CA1H and it is available for download for free. They even have a sample calling program, written in COBOL, that is used to verify the installation. There's not much more than copying, compiling, and adding some CICS table entries to get that solution up and running.


Because the provided samples utilize CICS Sockets. Sockets is only setup in about 10% of our CICS regions. Our shop is massive and I did not want to setup CICS Sockets in every region. I wanted a solution that required a few CSD entries and an interface program that could be transaction invoked and started off the sequential terminal.

This is something that a external hosting costumer requested and I wanted a quick and easy solution.

Instead I just created a step in the CICS region's job to simply read a cardlib and using an IEBGENER, I wrote the SYSUT2 to the SMTP sysout class.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Apr 05, 2011 11:06 am
Reply with quote

Quote:
Because the provided samples utilize CICS Sockets

only partially true!

Quote:
The sample programs show methods of interfacing a CICS application with SMTP. The programs are intended to demonstrate various methods of sending email from within a CICS application. This is accomplished by utilizing either the CICS SPOOL interface or the CICS TCP/IP sockets interface. The SPOOL interface requires the use of the MVS SMTP server. The sockets interface can utilize any SMTP server accessible on the TCP/IP network.


looks like the TS forgot to read completely the docs !
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 5:54 pm
Reply with quote

I'll admit that I did not read the doc thoroughly. I opened the Zip file containing the source code and I saw the calls to EZASOKET and I knew that it was not a route that I wanted to take.

Also, I wanted to see if the TDQ method would work...
Back to top
View user's profile Send private message
valyk

Active User


Joined: 16 Apr 2008
Posts: 104
Location: South Carolina

PostPosted: Tue Apr 05, 2011 11:16 pm
Reply with quote

It looks like I am going to have to eat my words. The batch step did not operate as expected.

So I used the Spool write method.

When I originally said, 'but that is very convoluted and would be irritating for someone in the future to come across.', I thought you were implying that I write a job to the internal reader.
Back to top
View user's profile Send private message
Earl Haigh

Active User


Joined: 25 Jul 2006
Posts: 475

PostPosted: Fri Apr 08, 2011 5:17 am
Reply with quote

Unemployed and too broke to retire.

That makes two of us..

I'm already practicing for the Job I'll need AFTER
the Java boys push me aside.

"do you want fries with that?"

icon_biggrin.gif

Earl
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 -> CICS

 


Similar Topics
Topic Forum Replies
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
No new posts Problem while sending special charact... JCL & VSAM 4
No new posts TXT2PDF and then SMTP email a PDF JCL & VSAM 4
No new posts Send email without SMTP All Other Mainframe Topics 5
Search our Forums:

Back to Top