![]() |
TIDIMAP4 - Mail Body als reinen text bekommen ?
Moin !
Kann mir jemand mal kurz nen Tip geben wie ich an den Body, also den normalen Text einer Mail komme? Habe es so probiert:
Delphi-Quellcode:
Aber das will nicht so recht. Da bekomme ich als Ergebnis wenn ich eine RTF oder HTML Mail im Posteingang habe :
function TGetMails.GetMailDetails(Part : TMailParts; ID : Integer) : string;
var TheMsg : TIdMessage; TheUID : string; nCount : integer; TheBody : string; begin TheMsg := TIdMessage.Create(nil); nCount := TheImap.MailBox.TotalMsgs; if nCount = 0 then begin ShowMessage('There are no messages in ' + TheImap.MailBox.Name); Exit; end else begin TheImap.GetUID (ID + 1, TheUID); TheImap.Retrieve(ID + 1, TheMsg); end; case Part of .... Part_Body : GetMailDetails := TheMsg.body.text; .... end; TheMsg.Destroy; end; Zitat:
|
Re: TIDIMAP4 - Mail Body als reinen text bekommen ?
Hi moelski,
Das mit dem Body ist korrekt. Die Texte sind über die MessageParts verstreut: Du mußt durch alle Text-Elemente in MessageParts iterieren:
Delphi-Quellcode:
Gruß,
var
i: Integer; begin ... for i := IdMessage.MessageParts.Count - 1 downto 0 do begin if (IdMessage.MessageParts[i] is TIdText) and (IdMessage.MessageParts[i].ContentType = 'text/html') then begin Memo1.Lines.AddString((IdMessage.MessageParts[i] as TIdText).Body); end; end; end; Assertor |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:42 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz