Forum > Spanish

SSL Error: TSendMail

(1/1)

PINO72:
Hola a todos.
Tengo una aplicación en la que utilizo la librería Synapse 40.1 + xmailer 1.0.0.0 para enviar correos electrónicos mediante la función TSendMail.

Al actualizar mi sistema operativo Raspbian Stretch (sudo update / upgrade) , ha dejado de funcionar y al intentar enviar correos me presenta el error "SSL Error : TSendMail".

La versión de openssl anterior era la 1.1.0f (mayo de 2017), la actualizada es la 1.1.0g (Noviembre 2018).

He instalado las librerías de desarrollo "openssl-dev" y sigue sin funcionar.
Versión Lazarus :1.8.4
Sistema Operativo : Raspbian Stretch (ARM Linux) sobre Raspberry PI 2b+
Synapse : 40.1 (Actualizada desde OnlinePackageManager)
xMailer 1.0.0.0 (Actualizada desde OnlinePackageManager)

Código utilizado:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TwVisualizacion.EnviaMailUsuario(MailsUsuario : TStringList; Var Mensaje : TStringList);Var    Mail : TSendMail; begin   Try    Mail:= TSendMail.Create;    Mail.Sender:= RegEmpresa.SenderSMTP;    Mail.Receivers.Text:= MailsUsuario.Text;    Mail.Subject:= 'Avisos ControlTemp 3.3';    Mail.Message.Text:= Mensaje.Text;    Mail.Smtp.UserName:= RegEmpresa.UserSMTP;    Mail.Smtp.Password:= RegEmpresa.PassSMTP;    Mail.smtp.Host:=RegEmpresa.ServerSMTP;    Mail.smtp.Port:= RegEmpresa.PuertoSMTP;    Mail.Smtp.FullSSL:= RegEmpresa.SSL_Connect;    Mail.smtp.AutoTLS:=RegEmpresa.AutoTS;    Mail.Smtp.Timeout:=5000;    mail.Smtp.Sock.SocksTimeout:=2000;      Try      Mail.Send;    Except      AddEvent('No se ha podido enviar la alarma por e-mail.' + Mail.smtp.FullResult.Text);    end;    finally    Mail.Free;   end;end;      
Os agradecería alguna pista ..

Muchas gracias de antemano.


bylaardt:
Yo uso esta función para enviar correo electrónico:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function MailSend(Const MailFrom,Replyto,SMTPHost,SMTPPort,user,password,MailTo, MailSubject,MailBody,Mailattachments,cripto: string): Boolean;var  SMTP: TSMTPSend;  sl:TStringList;  mime:TMimemess;  part: TMimepart;  x:integer;  anexo:TstringList;  error:string;  i,l:integer;  temp,MyMailTo,MailToSend:String;  mailSeparator:Char;begin  MailToSend:='';  i:=1;  MyMailTo:=trim(MailTo);  l:=Length(MyMailTo);  mailSeparator:=',';  while i<=l do begin    if MyMailTo[i] in [#1..#32,':',';','|',','] then begin      if (i>1) and (not(copy(MailToSend,length(MailToSend),1)=mailSeparator)) then        MailToSend:=MailToSend+mailSeparator;    end else      MailToSend:=MailToSend+MyMailTo[i];    inc(i);  end;  error:='';  Result:=False;  SMTP:=TSMTPSend.Create;  sl:=TStringList.Create;  mime:=TMimemess.create;  mime.Header.CharsetCode:=UTF_8;  sl.text:= SysToUTF8(MailBody);  part := mime.AddPartMultipart('mixed', nil);  mime.AddPartTextEx(sl,part,UTF_8,false,ME_BASE64);  Anexo:=TStringList.create;  anexo.text:=Mailattachments;  if anexo.Count>0 then begin    for x:=0 to anexo.count-1 do       mime.AddPartBinaryFromFile(anexo[x],part);    anexo.free;  end;  mime.header.subject:=SysToUTF8(MailSubject);  mime.header.from:=MailFrom;  mime.header.ReplyTo:=Replyto;  mime.Header.XMailer:=pb_SystemName;  mime.Header.Organization:='';  mime.EncodeMessage;  SMTP.UserName:=User;  SMTP.Password:=Password;  SMTP.TargetHost:=SMTPHost;  SMTP.AutoTLS:=cripto='TLS';  SMTP.FullSSL:=cripto='SSL';  SMTP.TargetPort:=SMTPPort;  if SMTP.Login then begin      result:=SMTP.MailFrom(Replyto, Length(mime.Lines.Text));      if result then begin        while result and (length(MailToSend)>0) do begin           temp:=trim(ExtractStrUtf8(MailToSend,mailSeparator));           if length(temp)>0 then             result:=SMTP.MailTo(temp);        end;        if result then begin          result:=SMTP.MailData(mime.lines);          if not result then            error:='MailData Error: '+smtp.ResultString;        end else error:='MailTo Error: '+smtp.ResultString;      end else error:='MailFrom Error: '+smtp.ResultString;      SMTP.Logout;  end else error:='Login Error: '+smtp.ResultString;  SMTP.Free;  sl.Free;  mime.free;  if (not result) and (length(trim(error))>0) then    raise Exception.Create(error)  else    DebugLn('Email','"'+MailSubject+'" enviado para "'+MailToSend+'".');end; 

PINO72:
Ante todo gracias por responder.

El problema no estaba en la función en sí, sospechaba que estaba en no tener instaladas las librerías de desarrollo para poder utilizar SSL y TLS (xmailer + sinapse 40.1).

Lo solucioné instalando el paquete "libssl1.0-dev".

Repito, gracias por responder y espero que le pueda servir a alguien que tenga el mismo problema.

Navigation

[0] Message Index

Go to full version