Ver Mensaje Individual
  #22  
Antiguo 02-03-2024
cervexa cervexa is offline
Miembro
 
Registrado: jul 2003
Ubicación: Galicia
Posts: 17
Reputación: 0
cervexa Va por buen camino
Gracias por responder.
No consigo que funcione, me da "Cold not load SSL library" al intentar conectar.
He copiado las DLL que posteaste arriba en el directorio del ejecutable, en c:\windows, en c:\windows\system, en c:\windows\system32... y no consige cargarlas.

El código que utilizo, en el que he ido cambiando las opciones en todas las combinaciones posibles, es este
Código:
var
  IdSSLIOHandlerSocket: TIdSSLIOHandlerSocketOpenSSL;
  IdSMTP: TIdSMTP;
  IdMessage: TIdMessage;
  IdText: TIdText;
  sAnexo: string;
begin
  IdSSLIOHandlerSocket := TIdSSLIOHandlerSocketOpenSSL.Create(Self);
  IdSMTP := TIdSMTP.Create(Self);
  IdMessage := TIdMessage.Create(Self);

  try
    with IdSSLIOHandlerSocket do begin
      SSLOptions.Method := sslvTLSv1;
      SSLOptions.Mode := sslmClient;
      SSLOptions.SSLVersions := [ sslvTLSv1 ];
    end;

    with IdSMTP do begin
      IOHandler := IdSSLIOHandlerSocket;
      UseTLS := utUseImplicitTLS;
      AuthType := satDefault;
      Port := 465;
      Host := 'smtp.micuenta.com';
      Username := 'rrhh@micuenta.com';
      Password := '7f6a8907sdfas';
    end;

    with IdMessage do begin
      From.Address := 'rrhh@micuenta.com';
      From.Name := 'Nome do Remetente';
      ReplyTo.EMailAddresses := IdMessage.From.Address;
      Recipients.Add.Text := unacuaneta@gmail.com';
      Recipients.Add.Text := 'otra@cuenta.com';
      Recipients.Add.Text := 'otra@distinta.com';
      Subject := 'Prueba de e-mail';
      Encoding := meMIME;
    end;

    IdText := TIdText.Create(IdMessage.MessageParts);
    with IdText do begin
      Body.Add('Corpo do e-mail');
      ContentType := 'text/plain; charset=iso-8859-1';
    end;

// ====================================================
// AQUI DA EL ERROR DE CONEXION--> Could not load SSL library
// ====================================================
    try
      IdSMTP.Connect;
      IdSMTP.Authenticate;
    except
      on E:Exception do
      begin
        MessageDlg('Error en la conexión o autentificación: ' +
          E.Message, mtWarning, [mbOK], 0);
        Exit;
      end;
    end;

    try
      IdSMTP.Send(IdMessage);
      MessageDlg('Mensaje enviado', mtInformation, [mbOK], 0);
    except
      On E:Exception do
      begin
        MessageDlg('Error al enviar el mensaje: ' +
          E.Message, mtWarning, [mbOK], 0);
      end;
    end;
  finally
    IdSMTP.Disconnect;
    UnLoadOpenSSLLibrary;
    FreeAndNil(IdMessage);
    FreeAndNil(IdSSLIOHandlerSocket);
    FreeAndNil(IdSMTP);
  end;
end;
Creo que pasan estas cosas:
-- No tengo la última version de las Indy: 10.6, que son las que ofrecen TLS1.2 aunque creo que el error es antes de llegar a utilizar el TLS, está en la carga de las DLL.
-- Mis indy y las DLL no deben de ser compatibles
Por esto estoy tratando de conseguir las Indy 10.6 y la última versión de openSSH ya compilada, por que no sabría hacerlo con los fuentes

No sé si me puedes ayudar en esto.
Un saludo
Responder Con Cita