Highlighted
Absent Member.
Absent Member.
2011 views

[archive] Sending mails using C$SOCKET

[Migrated content. Thread originally posted on 02 February 2005]

I have downloaded the sendmail.cbl program and tried by changing the SMTP server and other details as per our settings. But C$SOCKET call using AGS-CREATE-CLIENT fails by returning NULL. Hence the program displays "Unable to connect to server...".

Could anyone help me out in this. Do I need to make any changes to my PC settings?

Thanks,

Manoj C.
0 Likes
7 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

Perhaps the smtp server requires login?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

You may also want to check firewall settings.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

Thanks for the replies.

I have disabled the firewall client and tried. But still not working.

Using AGS-LAST-ERROR, I found out the error code as 11002. As mentioned in the copybook "socket.def", this indicates a warning AGS-TRY-AGAIN. As Mr. Dan Maltes has mentioned, is this because the SMTP server requires a login?

How can I login to the SMTP server through COBOL program, if I know the login-id and password?

Thanks,

Manoj C.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

I am trying to do the same, here is what i found out using telnet to port 25 at the smtp server...
*indicates a comment by me !
%what i typed

220 smtpserver.juni.org ESMTP 4.2b8 is glad to see you!
%EHLO *extended HELO
250-smtpserver.juni.org domain name should be qualified
250-HELP
250-PIPELINING
250-ETRN
250-DSN
250-TURN
250-ATRN
250-SIZE 10485760
250 EHLO
%auth login *initiate auth
334 VXNlcm5hbWU6 *base64 for 'Username:'
%bW05MjMyNQ== *
334 UGFzc3dvcmQ6 *base64 for 'Password:'
%OXIVOLVOLVo= *printf 'passwd'|mimencode (changed to keep it secret)
235 mm92325 relaying authenticated *yep, we logged on !

transfer your mail here

%QUIT *time to log off
221 smtpserver.juni.org SMTP closing connection


The principle is simple BUT:
To enter passwords and receive prompts, you need to be able to encode (and decode ) base64 (mime). i used mimencode in unix while doing this (printf 'mm92325'|mimencode). But i need to find out how to make it in cobol...
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

Hi Fans,

i've written a COBOL-Programm, which sends mail via C$SOCKET-Routines. This Programm is free for all users. It has been demonstrated on the AcuCorp Developer Conference in Munich, in November last year.

You can download the Sourcecode on

http://www.kiss-personal.de/cobolmail
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

Hey Peter,

thx for the programm. works fine.


bli
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Sending mails using C$SOCKET

:cool: Peter!

Thank you, this was a really nice implementation.

'Binary emulation' was a nifty trick to handle the shifting 🙂

Bernte
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.