#1 Re: mORMot 2 » Help with SendEmail for Lazarus » 2024-09-12 12:39:07

The port 465 is not blocked. I execute on Delphi and it works, but when I execute on Lazarus don't.

#2 mORMot 2 » Help with SendEmail for Lazarus » 2024-09-11 12:32:03

phss_phss
Replies: 4

I implemented the email service on my project in Delphi for Windows and it works:

  function TEmailService.Send : boolean;
var
  vContent: RawUtf8;
begin
  vContent := MergeTemplate;
  ValidaParametros;

  with FEmailSettings do
    Result := SendEmail(
      Host,
      User,
      FEmailTo,
      MimeHeaderEncode(StringToUtf8(FTemplate.S['Assunto'])),
      Utf8ToWinAnsi(vContent),
      Headers,
      User,
      Pass,
      Port,
      TextCharSet,
      TLS);
end;

But now I'm using a version of same project in Lazarus for linux and facing an issue, I guess it's because of missing lib:

 ESendEmail {Message:"Command failed for teste@microprocess.com.br at mail.microprocess.com.br:465 [Undefined Error]"} [TAppRestHttpSrv8083v1THttpSrvRe] at 49f1e5

What do I need to do or  wich files do I need to implement SendEmail in my Lazarus for Linux version?

#3 mORMot 2 » Function not receiving value from json when compiled to Linux64 » 2024-09-05 21:16:44

phss_phss
Replies: 3

I have a function whose parameter is filled with a json from a request:

function TEventoService.AddColeta(const pAmostraDados: TDTOEventoColeta): TServiceCustomAnswer;

dto:

TDTOEventoColeta:
TDTOEventoColeta = packed record
NumeroAmostra: RawUtf8;
PostoId: Int64;
end;

The json sent:

[{
    "NumeroAmostra": "0101",
    "PostoId": 1
}]

When I compile this project for Windows64 in Lazarus, and run the application, it works correctly. But if I compile it for Linux64 in Lazarus, the json is not passed to the function.
When I insert an additional property in my dto:

TDTOEventoColeta = packed record
NumeroAmostra: RawUtf8;
PostoId: Int64;
Dummy: RawUtf8;
end;

And I compiled it for Linux64, it passed the json correctly to the function.
Can someone explain to me what happens?

#4 mORMot 2 » How to make a CopyRecord in Free Pacal? » 2024-08-05 15:13:11

phss_phss
Replies: 2

I'm trying to migrate my code from Delphi to Free Pascal and I'm facing the chalange of make the CopyRecord metod from System in Delphi to Free Pascal.
I have the const pSolicitacao: TDTOSolicitacao and the var vSolicitacao: TDTOSolicitacao;
In my code I have to copy pSolicitacao to vSolicitacao because my function GetPosto is gonna change values from the record:

function TSolicitacaoService.Add(const pSolicitacao: TDTOSolicitacao): TServiceCustomAnswer;
var
  vSolicitacao: TDTOSolicitacao;
begin
  CopyRecord(@vSolicitacao, @pSolicitacao, TypeInfo(TDTOSolicitacao));
  if not GetPosto(vSolicitacao) then
  begin
    Result := ReturnRecordNotFound('Posto não encontrado.');
    Exit;
  end;
  etc...
end;

Anyone to help me with this migration?

Board footer

Powered by FluxBB