Experts Exchange connects you with the people and services you need so you can get back to work.
function getmailbodytext: string;
Loop, MsgPart: Integer;
Result := '';
MsgPart := Pred(FMessage.MessageParts.Count);
for Loop := 0 to MsgPart -1 do
if FMessage.MessageParts.Items[Loop] is TIdText then
Result := Result + TrimStr(TIdText(FMessage.MessageParts.Items[Loop]).Body.Text);
if MsgPart < 0 then
Result := TrimStr(FMessage.Body.Text);
Open in new window
for I := 0 to FMessage.MessageParts.Count -1 do
if FMessage.MessageParts[I] is TIdAttachment then
with TIdAttachment(FMessage.MessageParts[I]) do
Filname := 'C:\' + ExtractFileName(FileName);
if not FileExists(FilName) then
/Handle your error
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $151.20.
Premium members get this course for $24.94.
Premium members get this course for $159.20.
Premium members get this course for $349.00.
Premium members get this course for $62.50.