Get extended error information when error 11004 occurs using the TIdSmtp.Connect () method?

I have a Delphi 6 application that sends emails with attachments. When I first tested it, I received an 11004 error (violation of the rules) when I called TIdSmtp.Connect (). It turned out that my SMTP email server setup was wrong and now it works fine. But I know that my users will run into problems, and I would like to know if there is a way to get more extensive error information from the SMTP server through Indy components to help with my debugging efforts. I am using Indy 9 with Delphi 6.

Is there a way to get a much richer report and find out what is the likely cause of the error? (for example, SSL is required, the field is blank, rejected domain, etc.). Also, the same question, but when does an error occur in the TIdSmtp.Send () method?

+3
source share
1 answer

EIdSMTPReplyErroroccurs in response to an error message from the SMTP server at the SMTP protocol level. 11004- Socket / DNS error, not SMTP error. There would be no additional error information other than the main OS error message (which you can get from SysErrorMessage()):

The requested name is valid and was found in the database, but it does not have the correct associated data that is allowed for.

As for TIdSMTP.Send(), you can look for exceptions EIdSMTPReplyError, for example:

try
  IdSMTP1.Connect;
  try
    IdSMTP1.Send(IdMessage1);
  finally
    IdSMTP1.Disconnect;
  end;
except
  on E: EIdSMTPReplyError do
    Application.MessageBox(
      PChar(
        'Error message: ' + E.Message + sLineBreak +
        'Error code: ' + IntToStr(E.ErrorCode) + sLineBreak +
        'Error reply: ' + E.EnhancedCode.ReplyAsStr
      ),
      'SMTP Error...', MB_OK + MB_ICONSTOP + MB_TOPMOST);
end;

, , . , , , / SMTP .

SSL/TLS, , , TIdSMTP:

1) EIdSocketError, , 11004.

2) EIdSMTPReplyError , , SSL/TLS, TIdSMTP.UseTLS, utUseImplicitTLS.

2) EIdOSSLConnectError , OpenSSL, UseTLS=utUseImplicitTLS, SSL/TLS.

3) UseTLS, utUseExplicitTLS utRequiresTLS, TLS, - SSL/TLS - TIdSMTP.OnTLSHandShakeFailed, utUseExplicitTLS. VContinue=True, utRequiresTLS, EIdTLSClientTLSHandShakeFailed.

4) UseTLS utUseExplicitTLS utRequiresTLS, TLS, TIdSMTP.OnTLSNotAvailable, utUseExplicitTLS. VContinue=True, utRequiresTLS, EIdTLSClientTLSNotAvailable.

+6

All Articles