ioan
2008-07-09 17:06:47 UTC
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;
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;