.eml files to decode lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- QEnnay · 2022-02-05 19:07 Hi, I exported some emails and they are in xxx.eml format with the body being base64 encoded. I have written a rough 'n' dirty to decode the base64 but it is still in some form of XML/HTML (or whatever it is) encoding. I then tried using the HTMLDecode function but it left it the text XML/HTML Body unchanged. Is there some simple way to extract the actual email stuff from the .eml files? Thanks ---------------------------------------------------------------------- dsiders · 2022-02-05 20:26 Quote from: QEnnay on February 05, 2022, 08:07:42 pmI exported some emails and they are in xxx.eml format with the body being base64 encoded. I have written a rough 'n' dirty to decode the base64 but it is still in some form of XML/HTML (or whatever it is) encoding. I then tried using the HTMLDecode function but it left it the text XML/HTML Body unchanged. Is there some simple way to extract the actual email stuff from the .eml files? There is nothing simple about RFC 5322 message formats. Indy has the TIdMessage class which handles the headers and messages bodies. But I would not call it simple. ---------------------------------------------------------------------- QEnnay · 2022-02-05 21:38 Quote from: dsiders on February 05, 2022, 09:26:27 pmBut I would not call it simple. By "simple," I meant a Lazarus/FPC Library or code snippet. I just need to get rid of all the "
" etcTags within the base64 decoded text. ---------------------------------------------------------------------- winni · 2022-02-05 22:08 Hi! Something simple like this?? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure killTags (var s: string);var p,q : integer;beginrepeatp := pos ('<',s);q := pos ('>',s);if q > p then delete (s,p,q-p+1) else exit;until (p=0) or (q=0);;end;  Winni ---------------------------------------------------------------------- engkin · 2022-02-06 04:15 Class THTML2TextRenderer from unit HTML2TextRender: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses HTML2TextRender......function HTML2Text(const AHTMLStr:String):String;begin  with THTML2TextRenderer.Create(AHTMLStr) do    try      Result:=Render;    finally      Free;    end;end; ---------------------------------------------------------------------- JuhaManninen · 2022-02-06 10:41 Quote from: engkin on February 06, 2022, 05:15:43 amClass THTML2TextRenderer from unit HTML2TextRender: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses HTML2TextRender......function HTML2Text(const AHTMLStr:String):String;begin  with THTML2TextRenderer.Create(AHTMLStr) do    try      Result:=Render;    finally      Free;    end;end;I realized such a helper function should be included in the unit. I added it in 28dc8193a3. Function RenderHTML2Text. The renderer is used for Lazarus IDE hints when the TurboPowerIProDsgn package is not installed. ---------------------------------------------------------------------- engkin · 2022-02-06 14:04 Quote from: JuhaManninen on February 06, 2022, 11:41:59 amI realized such a helper function should be included in the unit. I added it in 28dc8193a3. Function RenderHTML2Text. Thank you!