INDY 10 TidMessagePart and TIDImapMessagepart lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- eldonfsr · 2023-11-01 13:50 I can not define TIdMessagePart sad not found but i use TIDImpMessagePart not error the problem is when i tried to assign value of part sad not match.. fmain.pas(448,17) Error: Incompatible types: got "TIdMessagePart" expected "TIdImapMessagePart"  Part: TIdImapMessagePart; no problem but  Part: TIdMessagePart;  problem not found Suppost TIdMessagePart must be global... 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 DisplayPartsMessage(aMsg: TIdMessage; aParentIndex, aLastIndex: Integer);var  Part: TIdImapMessagePart;   i: Integer;begin  for i := aLastIndex-1 downto aParentIndex+1 dobegin    Part := aMsg.MessageParts.Items[i];    //  Error: Incompatible types: got "TIdMessagePart" expected "TIdImapMessagePart"    if (Part.ParentPart = aParentIndex) and (Part is TIdText) then    begin      if IsHeaderMediaType(Part.ContentType, 'multipart/alternative') then    begin        DisplayMultiPartAlternative(aMsg, ParentPart.Index, aLastIndex);        Exit;      end;      if IsHeaderMediaType(ParentPart.ContentType, 'text/html') then      begin        DisplayHTML(TIdText(Part).Body);        Exit;      end;    if IsHeaderMediaType(Part.ContentType, 'text/plain') then      begin        DisplayPlainText(TIdText(Part).Body);        Exit;      end;      aLastIndex := i;    end;  end;  // nothing supported to display...end;                        some body can help me what is wrong.. ---------------------------------------------------------------------- Remy Lebeau · 2023-11-01 15:46 Quote from: eldonfsr on November 01, 2023, 02:50:38 pmI can not define TIdMessagePart sad not found Sounds like you did not add the IdMessageParts unit to your uses clause. Quote from: eldonfsr on November 01, 2023, 02:50:38 pmbut i use TIDImpMessagePart not error the problem is when i tried to assign value of part sad not match.. fmain.pas(448,17) Error: Incompatible types: got "TIdMessagePart" expected "TIdImapMessagePart" You can't assign a TIdMessagePart to a TIdImapMessagePart, and vice versa.  They are unrelated types. Since you are iterating through a TIdMessage, there is no reason to use TIdImapMessagePart at all.  That type is used only when you download an IMAP email into a TIdImapMessageParts instead of a TIdMessage. ---------------------------------------------------------------------- eldonfsr · 2023-11-01 20:10 Ok do how i can identify when parts of message or message is text/plain and text/html to display, the problem is when message has some replay witch going on several sections or parts... thanks... for clarify that...of message parts ---------------------------------------------------------------------- Remy Lebeau · 2023-11-01 22:55 Quote from: eldonfsr on November 01, 2023, 09:10:58 pmOk do how i can identify when parts of message or message is text/plain and text/html to display You already know the answer to that, since you are already doing it in the code you showed earlier - the TIdMessagePart.ContentType property tells you the media type of each part. Quote from: eldonfsr on November 01, 2023, 09:10:58 pmthe problem is when message has some replay witch going on several sections or parts... The only time I know of when that happens is when a parent part has a ContentType of 'multipart/related' and has children parts that relate to each other (ie, HTML with embedded media).  The parent part will tell you which child part is the "main" part (ie, the HTML) that refers to the other parts by their ContentID properties (ie, in HTML elements whose source are cid:... urls).