Generate HTML e-mail with embedded images in Delphi

后端 未结 5 1949
感情败类
感情败类 2020-12-11 06:28

Anyone know of a good example of generating HTML e-mail with embedded images and an alternate text part? I need to generate some tabular reports in HTML and would like to em

5条回答
  •  温柔的废话
    2020-12-11 07:06

    function data64(const filename:string): ansistring;
    // uses Classes, IdGlobalProtocols, EncdDecd;
    const
      crlf = #13#10;
    begin
      result := '';
      with TIdMimeTable.Create do
      try
        result := 'data:'
          + GetFileMIMEType(filename) + ';';
      finally
        Free;
      end;
      with TMemoryStream.Create do
      try
        LoadFromFile(filename);
        result := result + 'base64,' + crlf
          + EncodeBase64(Memory,Size);
      finally
        Free;
      end;
    end;
    

提交回复
热议问题