MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to Send email from a COBOL program ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ssd
Beginner


Joined: 24 Mar 2006
Posts: 25
Topics: 10

PostPosted: Wed May 16, 2007 1:17 pm    Post subject: How to Send email from a COBOL program ? Reply with quote

Hi,

I have a requirement where I need to send Email from a COBOL program.
Have anyone one tried this before

Thanks
ssd
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed May 16, 2007 1:27 pm    Post subject: Reply with quote

Tried it. Couldn't get the TCP/IP Socket calls to work properly for SMTP. Finally gave up and just coded a program to invoke a REXX exec that does the same Socket calls, but actually works.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed May 16, 2007 1:31 pm    Post subject: Reply with quote

SSd,

You just allocate a seq File and write the file containg FROM, TO, and other mail header tags followed by the text of the email. The next step takes in this file and route that file via SYSOUT to an SMTP Mail Server.

why are inclined to do everything in the program itself?

Quote:

Couldn't get the TCP/IP Socket calls to work properly for SMTP


Superk,

which port did you use? 25 or 80 ?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed May 16, 2007 1:47 pm    Post subject: Reply with quote

Our Exchange server looks at port 25 for SMTP.
Back to top
View user's profile Send private message
ssd
Beginner


Joined: 24 Mar 2006
Posts: 25
Topics: 10

PostPosted: Wed May 16, 2007 10:28 pm    Post subject: Reply with quote

Superk,
If you could send me some link having COBOL interface to SMTP,I would try it out on my part.

Kolusu,
The method you suggested looks great. Yet my requirement says no intermediate file should be involved and that the mail has to be sent directly sent from the program for certain critical errors that occur during processing .


Thanks for your reply guys.

SSD
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Thu May 17, 2007 7:20 am    Post subject: Reply with quote

z/OS V1R7.0 Comm Svr: IP Sockets Application Programming Interface Guide and Reference.
Back to top
View user's profile Send private message
Southington
Beginner


Joined: 02 Jun 2006
Posts: 6
Topics: 0
Location: Phoenix AZ

PostPosted: Thu May 17, 2007 3:19 pm    Post subject: Reply with quote

Requirements are made to be changed.
Back to top
View user's profile Send private message
Earl
Beginner


Joined: 09 Jun 2007
Posts: 26
Topics: 1

PostPosted: Sun Jun 10, 2007 9:40 am    Post subject: Reply with quote

you can write your email to a flat file, then feed into an SMTP jobstep.

However, best approach would be use a software product like Jes2Mail
www.casisoft.com

or if its CICS cobol , try www.pcs305.com select cics tools

Rolling Eyes
Back to top
View user's profile Send private message
Earl
Beginner


Joined: 09 Jun 2007
Posts: 26
Topics: 1

PostPosted: Sun Jun 10, 2007 8:20 pm    Post subject: Reply with quote

regarding ;;;

The method you suggested looks great. Yet my requirement says no intermediate file should be involved and that the mail has to be sent directly sent from the program for certain critical errors that occur during processing .


No way to do direct from a COBOL batch program that I'm aware, unless
you start using some additional vendor software.


You could try using a passthru to CICS for delivery of mail.
Check out BatchCICS and CICS/Notify. go to www.batchcics.com
contact the vendor and tell them what you are trying to accomplish. I'm sure they would be willing to help you out. Idea for some $
Back to top
View user's profile Send private message
peaglet
Beginner


Joined: 08 Jun 2007
Posts: 2
Topics: 0
Location: Chicago

PostPosted: Mon Jun 11, 2007 4:39 pm    Post subject: Reply with quote

how about writing the file to the intrdr with a dest of SMTP?
Back to top
View user's profile Send private message
Earl
Beginner


Joined: 09 Jun 2007
Posts: 26
Topics: 1

PostPosted: Mon Jun 11, 2007 8:51 pm    Post subject: Reply with quote

writing to INTRDR would require building entire JOB stream to execute SMTP. could be done, but a lot of extra code, ++ usage of INTRDR is normally written to a &temp intermediate file.

Thats why I suggested using vendor software, could then be used for other
functions.

Check out BatchCICS and CICS/Notify. go to www.batchcics.com
Rolling Eyes
Back to top
View user's profile Send private message
Earl
Beginner


Joined: 09 Jun 2007
Posts: 26
Topics: 1

PostPosted: Mon Jun 11, 2007 10:17 pm    Post subject: Reply with quote

there is another option. I've never tried it, but you could just write your smtp
statements to a 132char. width print output,

then have JCL pointing to correct class. Contact your tech support for specifics.

//SENDNOTE EXEC PGM=COBOLPGM
//SMTP132 DD SYSOUT=(B,SMTP)

COBOL CODE:::::::::::::::::::::::::::
SELECT PRINTOUT ASSING TO SMTP132.

FD PRINTOUT.
01 PRINTOUT-RECORD PIC X(132).

....
....
....
PROCEDURE DIVISION.
* BUILD MOVE STATEMENTS TO PRINTOUT-RECORD AND WRITE FOR SMTP *
HELO SY0F
MAIL FROM:<TEST COBOLPGM >
RCPT TO:<WHOEVER@MYCOMPANY.com >
DATA
TO: whoever@mycompany.com
SUBJECT:smtp mail test from a cobol program
CONTENT-TYPE: TEXT/PLAIN
Please do not reply to this email.
.
QUIT
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group