yn4v4s,
Cita:
...estoy desarrollando una App que envia un email a mi cuenta de correo (GMail)...
|
Revisa este código:
Código Delphi
[-]
procedure TfrmPrincipal.btnEnviarEmailClick(Sender: TObject);
begin
with IdMessage do
begin
Body.Clear();
Recipients.Clear();
Sender.Address := edEmailRemitente.Text;
Recipients.EMailAddresses := edEmailDestinatario.Text;
Subject := edAsuntoEmail.Text;
Body.AddStrings(mCuerpoEmail.Lines);
end;
with IdSMTP do
begin
IOHandler := IdSSLIOHandlerSocket;
IdSSLIOHandlerSocket.SSLOptions.Method := sslvSSLv23; IdSSLIOHandlerSocket.SSLOptions.Mode := sslmUnassigned;
IdSSLIOHandlerSocket.SSLOptions.VerifyMode := [];
IdSSLIOHandlerSocket.SSLOptions.VerifyDepth := 0;
Port := 465;
Host := edServidorSmtp.Text;
AuthenticationType := atLogin;
Username := edNombreUsuario.Text;
Password := edContrasenaUsuario.Text;
try
Connect(5000);
except
ShowMessage('Error de conexión');
end;
btnEnviarEmail.Enabled := false;
try
Send(IdMessage);
ShowMessage('Correo enviado con éxito');
finally
btnEnviarEmail.Enabled := true;
end;
if Connected then
Disconnect();
end;
end;
El código anterior
permite enviar emails usando Gmail como Mail Server por medio de Delphi 7, Indy 9 y openssl096. Quizás funcione correctamente en
Delphi 2010 y Indy v10.5.5
Las Dlls Indy openssl096 están disponibles en el link :
http://indy.fulgan.com/SSL/Archive/
El código anterior y sus Dlls esta disponible en el link:
http://terawiki.clubdelphi.com/Delph...Mail+Gmail.rar
Espero sea útil
Nelson.