×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hi All,
I know there are great tools available but for the time being our
requirement is to add authentication to our out going emails.
We have been using Scott's SMTPR4 for a long time and it has bee very
good.
I have modified the SMTP_hshake procedure to include an authentication
request.
The results I am getting looked promising but I am stuck after the 235
Authentication succeeded.
Any suggestions gratefully appreciated
Here is my joblog with debug enabled in the program
Connection to mail.smtp2go.com established
220 mail.smtp2go.com ESMTP Exim 4.96-S2G Thu, 08 Dec 2022 09:11:06 +0000
EHLO MSD820.XXX.LOCAL
250-mail.smtp2go.com Hello MSD820.XXX.LOCAL [11.222.111.55]
250-SIZE 52428800
250-8BITMIME
250-DSN
250-PIPELINING
250-PIPECONNECT
250-AUTH CRAM-MD5 PLAIN LOGIN
250-CHUNKING
250-STARTTLS
250-PRDR
250 HELP
AUTH LOGIN
334 VXNlcm5hbWU6
<user_name>
334 UGFzc3dvcmQ6
<password>
235 Authentication succeeded
RSET
500 unrecognized command
ERROR: Invalid reply code to RSET command.
MAIL FROM:<don.brown@xxxxxxxxxx>
ERROR: send(): Descriptor not valid.
SMTP set sender email address fail
Descriptor not valid.
I added the RSET based on an example I saw - really do not know if I need
it but I get a similar error if I omit it.
If I look at the connection log from a SMTP Diag tool it looks very
similar well the same to me.
Connecting to mail server.
Connected.
220 mail.smtp2go.com ESMTP Exim 4.96-S2G Wed, 07 Dec 2022 00:31:47 +0000
EHLO DON-1712
250-mail.smtp2go.com Hello DON-1712 [14.202.71.142]
250-SIZE 52428800
250-8BITMIME
250-DSN
250-PIPELINING
250-PIPECONNECT
250-AUTH CRAM-MD5 PLAIN LOGIN
250-CHUNKING
250-STARTTLS
250-PRDR
250 HELP
AUTH LOGIN
334 VXNlcm5hbWU6
<user_name>
334 UGFzc3dvcmQ6
<password>
235 Authentication succeeded
RSET
250 Reset OK
MAIL FROM: <don@xxxxxxxxxx>
250 OK
RCPT TO: <don@xxxxxxxxxx>
250 Accepted <don@xxxxxxxxxx>
DATA
354 Enter message, ending with "." on a line by itself
.
250 OK id=1p2iLm-bMGltl-06
Forcing disconnection from SMTP server.
QUIT
221 mail.smtp2go.com closing connection
Disconnected.
Message Sent Successfully
Here is the modified procedure ...
// -----------------------------------------
// Send HELO command
// -----------------------------------------
msg = 'EHLO ' + host + CRLF;
if ( sendtext(p_SMTP: msg) = *OFF );
return *OFF;
endif;
rc = response(p_SMTP);
if (rc = -1);
return *OFF;
endif;
if (rc <> 250);
SetError(SMTP_ERR_INVREPLY
: 'Invalid reply code to HELO command.');
return *OFF;
endif;
// -----------------------------------------
// Send AUTH LOGIN Command
// -----------------------------------------
msg = 'AUTH LOGIN ' + CRLF;
if ( sendtext(p_SMTP: msg) = *OFF );
return *OFF;
endif;
rc = response(p_SMTP);
if (rc = -1);
return *OFF;
endif;
if (rc <> 334);
SetError(SMTP_ERR_INVREPLY
: 'Invalid reply code to AUTH LOGIN command.');
return *OFF;
endif;
// -----------------------------------------
// Send USER Name base 64 encoded
// -----------------------------------------
msg = 'user@xxxxxxxxxx';
len = e2a( SMTP: msg : buf : %size(buf));
encLen = base64_encode( %addr (buf) : len : %addr(encData ) :
%size(encData ) -2);
%subst( encData: encLen+1 ) = CRLF;
if ( sendtext(p_SMTP: encData) = *OFF );
return *OFF;
endif;
rc = response(p_SMTP);
if (rc = -1);
return *OFF;
endif;
if (rc <> 334);
SetError(SMTP_ERR_INVREPLY
: 'Invalid reply code to USER name.');
return *OFF;
endif;
// -----------------------------------------
// Send Password base 64 encoded
// -----------------------------------------
msg = 'password';
len = e2a( SMTP: msg : buf : %size(buf));
encLen = base64_encode( %addr (buf) : len : %addr(encData ) :
%size(encData ) -2);
%subst( encData: encLen+1 ) = CRLF;
if ( sendtext(p_SMTP: encData) = *OFF );
return *OFF;
endif;
rc = response(p_SMTP);
if (rc = -1);
return *OFF;
endif;
if (rc <> 235);
SetError(SMTP_ERR_INVREPLY
: 'Authentication failed.');
return *OFF;
endif;
// -----------------------------------------
// Send RSET Command
// -----------------------------------------
msg = 'RSET ' + CRLF;
if ( sendtext(p_SMTP: msg) = *OFF );
return *OFF;
endif;
rc = response(p_SMTP);
if (rc = -1);
return *OFF;
endif;
if (rc <> 250);
SetError(SMTP_ERR_INVREPLY
: 'Invalid reply code to RSET command.');
return *OFF;
endif;
Thanks
Don
--
This email has been scanned for computer viruses. Although MSD has taken reasonable precautions to ensure no viruses are present in this email, MSD cannot accept responsibility for any loss or damage arising from the use of this email or attachments..
As an Amazon Associate we earn from qualifying purchases.
Follow-Ups :
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page . If you have questions about this, please contact
[javascript protected email address] .
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.