Indy 10 - IdSMTP.Send () se bloquea al enviar mensajes desde la cuenta de Gmail
Pregunta
Estoy intentando enviar un correo electrónico utilizando la cuenta de Gmail (Delphi 7, Indy 10) con estos valores:
TIdSmtp:
Port = 587;
UseTLS := utUseExplicitTLS;
TIdSSLIOHandlerSocketOpenSSL:
SSLOptions.Method := sslvTLSv1;
Todo parece estar bien establecido. Recibo esta respuesta:
Resolving hostname smtp.gmail.com.
Connecting to 74.125.77.109.
SSL status: "before/connect initialization"
SSL status: "before/connect initialization"
SSL status: "SSLv3 write client hello A"
SSL status: "SSLv3 read server hello A"
SSL status: "SSLv3 read server certificate A"
SSL status: "SSLv3 read server done A"
SSL status: "SSLv3 write client key exchange A"
SSL status: "SSLv3 write change cipher spec A"
SSL status: "SSLv3 write finished A"
SSL status: "SSLv3 flush data"
SSL status: "SSLv3 read finished A"
SSL status: "SSL negotiation finished successfully"
SSL status: "SSL negotiation finished successfully"
Cipher: name = RC4-MD5; description = RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5
; bits = 128; version = TLSv1/SSLv3;
Y luego se cuelga y no termina. El correo electrónico no se envía. ¿Cuál puede ser el problema?
Solución 2
El problema era simple. No era lo suficientemente paciente y la aplicación no se cuelgue, no había mucho tiempo de espera. El tiempo de espera era resultado de ajustes erróneos.
Otros consejos
Sí, he visto un montón de problemas con Indy10 y TLS (generalmente Gmail).
En primer lugar asegúrese de tener la última ssl bibliotecas de aquí
he visto puestos y errores intermitentes que se han resuelto en la versión borde de la sangría de Indy (es decir. Una liberación no estable). ver http://www.indyproject.org/sockets/download/svn.DE .aspx
para Gmail, generalmente uso implicityTLS en el puerto 465 ..
idSmtp := TIdSMTP.Create(nil);
try
idSmtp.IOHandler := nil;
idSmtp.ManagedIOHandler := true;
// try to use SSL
try
TIdSSLContext.Create.Free;
idSmtp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idSmtp);
if (smtpSettings.port = 465) then
idSmtp.UseTLS := utUseImplicitTLS
else
idSmtp.UseTLS := utUseExplicitTLS;
except
idSmtp.IOHandler.Free;
idSmtp.IOHandler := nil;
end;
if (idSmtp.IOHandler = nil) then
begin
idSmtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(idSmtp);
idSmtp.UseTLS := utNoTLSSupport;
end;
// send message, etc
finally
idSmtp.Free;
end;
En primer lugar, ¿ha comprobado el código está trabajando con otros servidores de correo electrónico?
Hace algún tiempo, alguien mencionó que estaban teniendo problemas con ciertos servidores de aceptar peticiones HTTP con el componente Indy TIdHTTP. La razón fue que tenían Indy incluido como parte del agente de usuario:
Request.UserAgent := 'Mozilla/3.0 (compatible; Indy Library)';
Cuando retiraron Indy Biblioteca funcionó. Evidentemente, ha habido algunos servicios web malignos creados con Indy, por lo que algunos sitios rechazarán las conexiones desde las aplicaciones creadas con él.
No estoy seguro de si el dispositivo que está utilizando tiene ningún tipo de propiedad agente de usuario. Pero si lo hace, nula cualquier referencia a Indy.
Cuando se prueba Indy, usted debe estar seguro de que “STOP en Delphi excepciones” está marcada (Herramientas, Opciones del depurador, excepciones Language).
Algunas rutinas, específicamente idSMTP.Send, ‘come’ (u oculta) excepciones que resultan en un cuelgue.