I use TMimeMess for decoding incoming e-mails of my SMTP server based on Synapse.
I discovered that for decoding 50MB MIME message (simple text with attachments), TMimeMess used 600-800MB of memory.
Decoding code here:
FMimeMsg.Header.DecodeHeaders(FMimeMsg.MessagePart.Lines);
FMimeMsg.MessagePart.DecomposeParts;
ExtractPartsFromMess(FMimeMsg.MessagePart);
...
procedure ExtractPartsFromMess(AMimePart: TMimePart);
var i: integer;
begin
if AMimePart.GetSubPartCount = 0 then
Begin
if (AMimePart.PrimaryCode = MP_TEXT) then
Begin
AMimePart.DecodePart;
FBody.Add(string(ReadStrFromStream(AMimePart.DecodedLines,AMimePart.DecodedLines.Size)));
end
else if (AMimePart.PrimaryCode = MP_BINARY) then
Begin
if AMimePart.FileName <> '' then
Begin
AMimePart.DecodePart;
AMimePart.DecodedLines.SaveToFile(FPathToIncomingFolder+AMimePart.FileName);
end;
end;
end
else
Begin
for i:=0 to AMimePart.GetSubPartCount-1 do
Begin
ExtractPartsFromMess(AMimePart.GetSubPart(i));
end;
end;
end;
Thanks.