Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-03-2013
yn4v4s yn4v4s is offline
Miembro
NULL
 
Registrado: may 2012
Posts: 33
Poder: 0
yn4v4s Va por buen camino
Problema con librerias SSL al enviar email

Hola a todos, estoy desarrollando una App que envia un email a mi cuenta de correo (GMail), y utilize el siguiente codigo:


procedure TForm1.btnConnectClick(Sender: TObject);
var

SMTP: TIdSMTP;
Mail: TIdMessage;


begin

IdSMTP_SendMail := TIdSMTP.Create(Self);

with IdSMTP_SendMail do begin
IoHandler:=SSLIOHandler;
AuthType := satDefault;
Host := 'smtp.gmail.com';
port := 465 ;
useTLS:=utUseExplicitTLS;
Username := mi_cuenta;
Password := mi_password;
end;

mail := TIdMessage.Create(Self);
with mail do begin
From.Address := mi_cuenta;
Recipients.EMailAddresses := cuenta_del_destinatario;
Subject := 'Hola';
body.Text := 'Esto es una prueba';
end;


IdSMTP_SendMail.Connect;


IdSMTP_SendMail.Send(mail);

end;

//---------------------------------------------

La App me da la siguiente excepcion:

First chance exception at $75244B32. Exception class EIdOSSLCouldNotLoadSSLLibrary with message 'Could not load SSL library.'. Process Project1.exe (3360)

He descargado e instalado las siguientes librerias:

"libeay32.dll", "libSSL32.dll" y "ssleay32.dll", "MSVCR100.dll" y "VSINIT.dll"

Las copie en C:\Windows\SysWOW64 ya que tengo Win8 x64.

Uso el Embarcadero RAD Studio 2010 y Indy v10.5.5

Agradeceria mucho su ayuda... 1000 Gracias
Responder Con Cita
  #2  
Antiguo 13-03-2013
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.040
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Recuerda poner los tags al código fuente, ejemplo:



Gracias
Responder Con Cita
  #3  
Antiguo 13-03-2013
yn4v4s yn4v4s is offline
Miembro
NULL
 
Registrado: may 2012
Posts: 33
Poder: 0
yn4v4s Va por buen camino
con tap

Código Delphi [-]
procedure TForm1.btnConnectClick(Sender: TObject);
var

  SMTP: TIdSMTP;
  Mail: TIdMessage;


begin

IdSMTP_SendMail := TIdSMTP.Create(Self);

with IdSMTP_SendMail do begin
IoHandler:=SSLIOHandler;
AuthType := satDefault;
Host := 'smtp.gmail.com';
port := 465 ;
useTLS:=utUseExplicitTLS;
Username := mi_cuenta;
Password := mi_password;
end;

mail := TIdMessage.Create(Self);
with mail do begin
From.Address := mi_cuenta;
Recipients.EMailAddresses := cuenta_del_destinatario;
Subject := 'Hola';
body.Text := 'Esto es una prueba';
end;


IdSMTP_SendMail.Connect;


IdSMTP_SendMail.Send(mail);

end;
Responder Con Cita
  #4  
Antiguo 13-03-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
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; // sslv : SSLv2, SSLv3, TLSv1, SSLv23.
    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.
Responder Con Cita
  #5  
Antiguo 13-03-2013
yn4v4s yn4v4s is offline
Miembro
NULL
 
Registrado: may 2012
Posts: 33
Poder: 0
yn4v4s Va por buen camino
gracias hermano voy a probar
Responder Con Cita
  #6  
Antiguo 13-03-2013
yn4v4s yn4v4s is offline
Miembro
NULL
 
Registrado: may 2012
Posts: 33
Poder: 0
yn4v4s Va por buen camino
funciono perfecto, gracias hermano.
Responder Con Cita
  #7  
Antiguo 13-03-2013
yn4v4s yn4v4s is offline
Miembro
NULL
 
Registrado: may 2012
Posts: 33
Poder: 0
yn4v4s Va por buen camino
Unhappy No funciona con Indy 10.5.5

Hola, el problema es el siguiente:

El componente IdSSLIOHandlerSocket no existe en Delphi 2010 (Indy 10.5.5) en cambio tube que sustituirlo por un IdSSLIOHandlerSocketOpenSSL en el cual la propiedad AuthenticationType ha cambiado a AuthType y atLogin no se ve por ninguna parte, ahora quedaria de la siguiente manera:

Código Delphi [-]
AuthType := satSASL;

1ero: Al enviar recibo la misma excepcion "Could not load SSL Library", luego de esto me he descargado el archivo openssl-1.0.1e-i386-win32.zip desde http://indy.fulgan.com/SSL/ con lo que ya no me pide dicha libreria, pero ahora el programa se cuelga al enviar.

Agradeceria que me ayudaran...
Responder Con Cita
  #8  
Antiguo 14-03-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Poder: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
yn4v4s,

Cita:
Empezado por yn4v4s
...No funciona con Indy 10.5.5...
Revisa el Msg #24 de este link:
Espero sea útil

Nelson.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema al enviar un email con acentos en Delphi 2009 Quim Herrera Internet 2 18-01-2012 16:43:27
Problema con Formato de texto al enviar un email m.ruiz Varios 2 07-11-2007 12:59:43
Problema al Enviar EMAIL con Indys AGAG4 Internet 1 05-04-2006 17:59:17
Problema para enviar email con indy delphi7 cmena Internet 2 13-10-2005 21:58:55
Problema al enviar Email con adjuntos usando el componente Idsmtp de las indy Nbull Internet 2 22-11-2004 09:23:38


La franja horaria es GMT +2. Ahora son las 15:26:04.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi