I'm trying to create multipart/related attachment with such code:
var
Msg: TIdMessage;
Attachment: TIdAttachmentFile;
begin
Msg := TIdMessage.Create(nil);
try
Attachment := TIdAttachmentFile.Create(Msg.MessageParts, 'D:\temp\CachedImage.jpg');
Attachment.ContentType := 'multipart/related';
Attachment.ContentTransfer := 'binary';
Attachment.ContentDisposition := 'attachment; filename="CachedImage.jpg"';
Msg.SaveToFile('d:\temp\MyFile.eml');
finally
Msg.Free;
end;
end;
I'm expecting that it saves the attached file as EML file. But it does not.
Saved only part of the header and nothing more:
MIME-Version: 1.0
Date: Sat, 25 Mar 2023 09:38:31 +0300
--
Content-Type: multipart/related;
boundary="0dZDwVffh1i=_ZLFRXeMyvVY4y2H5QDJoX"
How to fix such issue? I'm using Delphi 10.4.2 with installed Indy version.