I'm using the following code, but I'm getting html or even base64, I don't know how to decode that in plain text. What is the correct way to read the email content in my delphi app?
var
TheFlags: TIdMessageFlagsSet;
TheUID: string;
nCount: integer;
TheMsg: TIdMessage;
MailBoxName: string;
lacadena:string;
begin
nCount := TheImap.MailBox.TotalMsgs;
for i := 0 to nCount do
begin
TheImap.GetUID(i, TheUID)
TheImap.UIDRetrieveText(TheUID, lacadena);
dbmmoemcontent.text :=lacadena;
end;
end
Try using UIDRetreive()
instead of UIDRetrieveText()
. UIDRetreive()
retrieves the entire email, headers and all, and then decodes it into a TIdMessage
. UIDRetrieveText()
, on the other hand, retrieves just the raw text of the email body without any headers, and is not decoded in any way other than to convert the raw bytes into a String
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.