Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Error Al Enviar E-mail con Delphi (TAuthenticationType) (https://www.clubdelphi.com/foros/showthread.php?t=91148)

webmasterplc 19-11-2016 12:17:58

Error Al Enviar E-mail con Delphi (TAuthenticationType)
 
Buenos hace un tiempo rescate una funcion de internet, para enviar correos , la misma funciono perfecto en delphi 7 ahorita tengo xe8 y me saltan varios errores, he buscado en el club errores relacionados y nada
aqui esta el codigo y los errores

Código Delphi [-]
function enviarEmail (servidor : string; usuario : string; contrasena : string;
    puerto : integer; asunto : string; mensaje : TStringList; conAutenticacion : boolean;
    emisor : string; nombreEmisor : string; destinatario : string; cc : string) : boolean;
var
  compMensaje : TIdMessage;
  textoTemp : string;
  tipoAutenticacion : TAuthenticationType;
  envioCorrecto : boolean;
begin
  if conAutenticacion then
  begin
    compEnvioEmail.AuthenticationType := atLogin;
    compEnvioEmail.UserId := usuario;
    compEnvioEmail.Password := contrasena;
  end
  else
    compEnvioEmail.AuthenticationType := atNone;
  compMensaje := TIdMessage.Create (nil);
  compMensaje.From.Address := emisor;
  compMensaje.From.Name := nombreEmisor;
  compMensaje.Recipients.Add.Address := destinatario;
  compMensaje.CCList.Add.Address := cc;
  compMensaje.Body.AddStrings (mensaje);
  compMensaje.Subject := asunto;
  compMensaje.ReplyTo.Add.Address := emisor;
  envioCorrecto := true;
  try
    compEnvioEmail.Send(compMensaje);
  except
    envioCorrecto := false;
  end;
  compMensaje.Free;
  enviarEmail := envioCorrecto;
end;

errores

Cita:

[dcc32 Warning] UnitComunicaciones.pas(29): W1035 Return value of function 'ConectarServidorEmail' might be undefined
[dcc32 Error] UnitComunicaciones.pas(38): E2003 Undeclared identifier: 'TAuthenticationType'
[dcc32 Error] UnitComunicaciones.pas(43): E2003 Undeclared identifier: 'AuthenticationType'
[dcc32 Error] UnitComunicaciones.pas(43): E2003 Undeclared identifier: 'atLogin'
[dcc32 Error] UnitComunicaciones.pas(44): E2003 Undeclared identifier: 'UserId'
[dcc32 Error] UnitComunicaciones.pas(48): E2003 Undeclared identifier: 'AuthenticationType'
[dcc32 Error] UnitComunicaciones.pas(48): E2003 Undeclared identifier: 'atNone'
[dcc32 Fatal Error] Comercializacion.dpr(42): F2063 Could not compile used unit 'UnitComunicaciones.pas'

dec 19-11-2016 15:34:25

Hola,

Echa un vistazo a "compEnvioEmail". Si es del tipo "TIdSMTP", como creo que es, entonces en Indy 10 (la versión que incluye Delphi XE8) debes usar algo así:

Código Delphi [-]
IdSMTP1.AuthType := satNone;

O bien otro valor posible para "AuthType". Ya no existe "TAuthenticationType" sino que es "TIdSMTPAuthenticationType" que se encuentra declarado en la misma unidad "IdSMTP".


La franja horaria es GMT +2. Ahora son las 08:30:17.

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