A product I work on uses the Indy components to send emails. It is developed in RAD Studio XE4 (C++). I am trying to find out why it works on some computers but not on others. Of course, it works on my dev box. On the test box I either get a "connection closed gracefully" message or a socket error 10054.
Both machines are loading the same Indy files. My dev box is running Win 8.1 and the test box is running Win 7, so some of the Windows DLLs are different versions, but I doubt that is the problem.
I wrote a very simple test app, and it exhibits the same behavior.
The SMTP messages on my dev box look like this:
S: 220 smtp.gmail.com ESMTP vf11sm8649345igb.20 - gsmtp
C: EHLO ks-sayers-v60
S: 250-smtp.gmail.com at your service, [64.132.205.66]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-STARTTLS
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 SMTPUTF8
C: STARTTLS
S: 220 2.0.0 Ready to start TLS
C: EHLO ks-sayers-v60
S: 250-smtp.gmail.com at your service, [64.132.205.66]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 SMTPUTF8
The SMTP messages on my test box look like this:
S: 220 smtp.gmail.com ESMTP s19sm631546ign.4 - gsmtp
C: EHLO ks-dsatest-v41
S: 250-smtp.gmail.com at your service, [64.132.205.66]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-STARTTLS
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 SMTPUTF8
C: STARTTLS
S: 220 2.0.0 Ready to start TLS
C: QUIT
I'm using the same gmail user and password in both tests. I am not sure why my test app is sending a QUIT message on the test box instead of an EHLO.
Any help or ideas what to look at will be greatly appreciated!
RAD Studio XE4
Indy 10.6.0.4975
ssleay32.dll/libeay32.dll are v1.0.0g
Test code:
void __fastcall TForm1::btnSendClick(TObject *Sender)
{
IdLogFile1->Active = true;
try
{
try
{
IdSMTP1->ConnectTimeout = 30000;
IdSMTP1->Username = edtFrom->Text;
IdSMTP1->Password = edtPassword->Text;
IdMessage1->Recipients->Clear();
IdMessage1->Recipients->Add();
IdMessage1->Recipients->Items[0]->Address = edtTo->Text;
IdSMTP1->Connect();
if (IdSMTP1->Connected())
{
IdSMTP1->Send(IdMessage1);
}
LogSmtpSettings();
}
catch (Exception & e)
{
LogSmtpSettings();
throw Exception(e.Message);
}
}
__finally
{
IdLogFile1->Active = false;
}
}
Here are the properties of the TIdSMTP component:
Indy Version: 10.6.0.4975
Host: smtp.gmail.com
Port: 587
HELO Name:
Mail Agent:
IOHandler: TIdSSLIOHandlerSocketOpenSSL
Connection Timeout: 30000
Read Timeout: -1
Authentication Type: Default
Validate Auth Login: True
Username: '[email protected]'
Use EHLO: True
TLS: Explicit TLS
Use Nagle: True
Use Pipelining: True
Use VERP: False
VERP Delimiters: none
Intercept: TIdLogFile
Intercept IsClient: True
Supports TLS: True
Last Command Result: Ready to start TLS
throw;
instead ofthrow Exception(e.Message);
. The latter loses all kinds of useful information. – Remy Lebeau