Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jul : HTML Attachments in POP3 (Indy 10)

www.cryer.info
Managed Newsgroup Archive

HTML Attachments in POP3 (Indy 10)

Subject:HTML Attachments in POP3 (Indy 10)
Posted by:"ioan" (than..@but-no-thanks.com)
Date:Wed, 9 Jul 2008 10:06:47

I'm using this code to save the body of the email and the attachments.
In Indy 10, if the attachment is a HTML document, the code will save it
as the email body (in the "body text" part of the code). I compiled the
same code in Indy 9, and the HTML attachment was saved as an attachment
(in the "general attachment" part of code).

How should I handle html attachments in indy 10? Can somebody send me a
sample code please?

I have latest Indy 9 and Indy 10 installed.

TIA,
-ioan

FilePrefix := MakeUniqueCorrelation(AppPath);
for i := 0 to AMsg.MessageParts.Count - 1 do
begin
   if (AMsg.MessageParts.Items[i] is TIdAttachment) then
   begin
     //general attachment
     TIdAttachment(AMsg.MessageParts.Items[i]).
         SaveToFile(TIdAttachment(AppPath + 'inbox' + PathDelim +

         AMsg.MessageParts.Items[i]).Filename);
   end
   else
   begin

     //body text
     if AMsg.MessageParts.Items[i] is TIdText then
     begin
       TIdText(AMsg.MessageParts.Items[i]).Body.
       SaveToFile(AppPath + 'inbox' + PathDelim + FilePrefix + '.bdy');
     end
   end;
end;

Replies:

www.cryer.info
Managed Newsgroup Archive