Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A bug in new version of Indy in TIdSMTP
#2
(05-07-2018, 08:40 PM)johnmay Wrote:
Code:
IdSMTP1->Host = "smtp.charter.net";
IdSMTP1->Port = 25;
IdSMTP1->Connect();

The server issues:
571 impout002 charter.net OTQuMjUzLjI0My4zNQ== You must connect from Charter IP space.  E1110

That error message means your TIdSMTP is connecting to Charter's SMTP server from a machine that is not connected to Charter's network and thus does not have an IP address that is assigned by Charter.  That has nothing to do with Indy.

(05-07-2018, 08:40 PM)johnmay Wrote: But IdSMTP raises an exception:

Project Project1.exe raised exception class EIdSMTPReplyError with message 'impout003 charter.net OTQuMjUzLjI0My4zNQ== You must connect from Charter IP space.  E1110'.

As it should be.  When you connect to an SMTP server, the server sends an initial SMTP greeting before the client can send any SMTP commands.  In the above case, that greeting has a reply code of 571 (which is technically an invalid reply code, as any reply code >= 560 is undefined by the SMTP protocol specs).  All 5xx reply codes are fatal errors.  The only reply code that is allowed in the greeting to indicate a successful SMTP session is 220, per the SMTP protocol specs.  TIdSMTP detects that non-220 reply code and raises the exception, and closes the socket connection.

This is normal and expected behavior.

(05-07-2018, 08:40 PM)johnmay Wrote: There is also problem connecting to:

Code:
IdSMTP1->Host = "mobile.charter.net";
IdSMTP1->Port = 587;
IdSMTP1->UseTLS = utUseImplicitTLS;
IdSMTP1->Connect();

Project Project1.exe raised exception class EIdSocketError with message 'Socket Error # 10060 Connection timed out.'.

SMTP port 587 is an EXPLICIT TLS port.  You should be using utUseExplicitTLS on it.

SMTP port 465 is an IMPLICIT SSL port.  You should be using utUseImplicitTLS on it.

SMTP port 25 doesn't use SSL/TLS.  You should be using either utNoTLSSupport or utUseExplicitTLS on it.

That being said, do note that setting the UseTLS property CAN CHANGE the Port property!  In your case, you are setting the Port property to the standard EXPLICIT TLS port 587 before setting the UseTLS property to utUseImplicitTLS.  The UseTLS property setter knows that 587 is a standard SMTP port, and will consequently change the Port property to the SMTP IMPLICIT SSL port 465.  So that is the port you are actually connecting to, not to port 587 like you specified.  And that would explain the timeout error, because Charter doesn't use port 465.

If you want to use a specific port with a non-standard UseTLS value, you need to set the Port property after setting the UseTLS property:

Code:
IdSMTP1->Host = "mobile.charter.net";
IdSMTP1->UseTLS = utUseImplicitTLS;
IdSMTP1->Port = 587; // <-- moved down here
IdSMTP1->Connect();

(05-07-2018, 08:40 PM)johnmay Wrote: Older version of Indy connects fine using exact same settings above (587 + implicit TLS).

Older version of Indy (5373) works fine for both of the above settings...

The UseTLS property setter in 5373 was not aware of explicit TLS ports, that logic was added in 5382.  In which case, in 5373, setting the UseTLS property to utUseImpliciTLS would change the Port to 465 only if the Port was 25, which is not the case in your situation.  Now, it does change the Port from 587 to 465, because port 587 is expected to use EXPLICIT TLS, not IMPLICIT SSL.

(05-07-2018, 08:40 PM)johnmay Wrote: In above connection 587 is implicit port

It is SUPPOSED to be an EXPLICIT TLS connection.

(05-07-2018, 08:40 PM)johnmay Wrote: it is non-standardl but that's how Charter have it set up and until recently it connected well using older TIdSMTP

Then you should complain to Charter, because this is a major flaw on their part. Everyone else in the world uses EXPLICIT TLS on SMTP port 587, and IMPLICIT SSL on SMTP port 465.

Reply


Messages In This Thread
RE: A bug in new version of Indy in TIdSMTP - by rlebeau - 05-08-2018, 12:11 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)