- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Cobol calling MAIL routines to send SMTP ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 05:14 AM
тАО04-09-2008 05:14 AM
We need an existing Cobol program to send SMTP emails. We do not need/want to have any VMS MAIL messages sent/saved. Replies will not come back to VMS (they will be received by an Exchange mailbox/public folder/distro list ... whatever gets decided).
Is this possible? Any chance there's a sample somewhere?
COBOL T5.4-51 (14-DEC-1997! Wonder if it's out of field test yet ;-), VAX/VMS v6.2, TCPware v5.6-2. SMTP is configured and functional.
Cheers,
Art
Solved! Go to Solution.
- Tags:
- COBOL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 05:27 AM
тАО04-09-2008 05:27 AM
Re: Cobol calling MAIL routines to send SMTP ...
YES
Why not do a spawn in cobol and use DCL to mail ?
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 05:33 AM
тАО04-09-2008 05:33 AM
Re: Cobol calling MAIL routines to send SMTP ...
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 05:37 AM
тАО04-09-2008 05:37 AM
SolutionHere is my code in enclosure. In use by our applications. WMS, logical names and some other stuff is specific to our environment.
To direct all replies to a certain mail addres :
define tcpip$smtp_from "art_master@brol.com"
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 05:50 AM
тАО04-09-2008 05:50 AM
Re: Cobol calling MAIL routines to send SMTP ...
On the other hand, it is simple and efficient to just create a subroutine to mail in line. I'd write it in C and call from Cobol, but writting in Cobol is trivial.
I found an example. See below.
You'd have to provide it the MAIL$ symbols for example by creating a helper module MAILDEF as:
$ cre maildef.mar
.TITLE MAILDEF
$MAILDEF GLOBAL
$MAILMSGDEF GLOBAL
.END
Exit
$ macr maildef
$ cob mail
$ link mail,maildef
The Cobol is not mine (Bruce Whacker?), nor my style.
You would have to decide how 'fatal' MAIL$ errors are, and just let Email SIGNAL, or trap and handle. Whether you send or abort mail$send_end should be called.
Enjoy!
identification division.
program-id. sendmail.
data division.
working-storage section.
01 stat pic s9(9) comp.
01 context pic 9(9) comp value 0.
01 null-item.
03 filler pic 9(4) comp value 0.
03 filler pic 9(4) comp value 0.
03 filler pic 9(9) comp value 0.
03 filler pic 9(9) comp value 0.
01 dummy-len pic 9(9) comp.
01 subject pic x(12) value 'test subject'.
01 subject-item.
03 subject-len pic 9(4) comp value 12.
03 filler pic 9(4) comp value external mail$_send_subject.
03 subject-addr pointer value reference subject.
03 filler pointer value reference dummy-len.
03 filler pic 9(9) comp value 0.
01 first_addressee pic x(64) value 'hein'.
01 second_addressee pic x(64) value 'heinvandenheuvel@xxx.yyy'.
01 addr-item.
03 addr-user-len pic 9(4) comp value 64.
03 filler pic 9(4) comp value external mail$_send_username.
03 addr-user-addr pointer value reference first_addressee.
03 filler pointer value reference dummy-len.
03 filler pic 9(9) comp value 0.
01 line1 pic x(6) value 'line 1'.
01 line2 pic x(6) value 'line 2'.
01 body-item.
03 body-file-len pic 9(4) comp value 6.
03 filler pic 9(4) comp value external mail$_send_record.
03 body-file-addr pointer value reference line1.
03 filler pointer value reference dummy-len.
03 filler pic 9(9) comp value 0.
procedure division.
main.
initialize context
call 'mail$send_begin' using context, null-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
else
call 'mail$send_add_attribute' using context, subject-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
else
call 'mail$send_add_address' using context, addr-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
end-if
set addr-user-addr to reference of second_addressee
call 'mail$send_add_address' using
context, addr-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
else
call 'mail$send_add_bodypart' using
context, body-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
else
set body-file-addr to reference of line2
call 'mail$send_add_bodypart' using
context, body-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
else
call 'mail$send_message' using
context, null-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
end-if
end-if
end-if
end-if
end-if
if stat is failure
call 'mail$send_abort' using context, null-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
end-if
else
call 'mail$send_end' using context, null-item, null-item
giving stat
if stat is failure
call 'lib$signal' using by value stat
end-if
end-if
exit program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 06:14 AM
тАО04-09-2008 06:14 AM
Re: Cobol calling MAIL routines to send SMTP ...
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-09-2008 06:19 AM
тАО04-09-2008 06:19 AM
Re: Cobol calling MAIL routines to send SMTP ...
My procedure has the advantage :
1) mailing is done in batch (think about big files !), thus increasing speed and possibility to put a low job limit on the queue. Only verifying of params and doing a backup is done in real time.
2) mails files as attachment with auto convert to a pc type
3) has the possibility to convert to PDF (we have listings wider than 1 pc screen and pdf will be match with screen width)
4) will backup/ign locked files (don't know what mail will do)
5) keeps a backup store of the mailed files
6) handle wild cards
7) check maximum mail size (warning only, we have limits of 5 MB)
Fwiw
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2008 05:30 PM
тАО04-13-2008 05:30 PM
Re: Cobol calling MAIL routines to send SMTP ...
An alternative which might be simpler than dealing with MAIL$ routines with item lists and stuff that looks a bit ugly in COBOL, try using routine TCPIP$SMTP_SEND_FROM_FILE.
See TCPIP docs for full details. Basic principle is to put all the addressing details in a text file, then pass it to SFF.
Not sure if it works with TCPware, or as far back as V6.2