View previous topic :: View next topic |
Author |
Message |
ssd Beginner
Joined: 24 Mar 2006 Posts: 25 Topics: 10
|
Posted: Wed May 16, 2007 1:17 pm Post subject: How to Send email from a COBOL program ? |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed May 16, 2007 1:27 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed May 16, 2007 1:31 pm Post subject: |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed May 16, 2007 1:47 pm Post subject: |
|
|
Our Exchange server looks at port 25 for SMTP. |
|
Back to top |
|
 |
ssd Beginner
Joined: 24 Mar 2006 Posts: 25 Topics: 10
|
Posted: Wed May 16, 2007 10:28 pm Post subject: |
|
|
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 |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
|
Back to top |
|
 |
Southington Beginner

Joined: 02 Jun 2006 Posts: 6 Topics: 0 Location: Phoenix AZ
|
Posted: Thu May 17, 2007 3:19 pm Post subject: |
|
|
Requirements are made to be changed. |
|
Back to top |
|
 |
Earl Beginner
Joined: 09 Jun 2007 Posts: 26 Topics: 1
|
Posted: Sun Jun 10, 2007 9:40 am Post subject: |
|
|
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
 |
|
Back to top |
|
 |
Earl Beginner
Joined: 09 Jun 2007 Posts: 26 Topics: 1
|
Posted: Sun Jun 10, 2007 8:20 pm Post subject: |
|
|
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. for some $ |
|
Back to top |
|
 |
peaglet Beginner
Joined: 08 Jun 2007 Posts: 2 Topics: 0 Location: Chicago
|
Posted: Mon Jun 11, 2007 4:39 pm Post subject: |
|
|
how about writing the file to the intrdr with a dest of SMTP? |
|
Back to top |
|
 |
Earl Beginner
Joined: 09 Jun 2007 Posts: 26 Topics: 1
|
Posted: Mon Jun 11, 2007 8:51 pm Post subject: |
|
|
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
 |
|
Back to top |
|
 |
Earl Beginner
Joined: 09 Jun 2007 Posts: 26 Topics: 1
|
Posted: Mon Jun 11, 2007 10:17 pm Post subject: |
|
|
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 |
|
 |
|
|