10-27-2024, 07:08 PM
I run into a real problem here.
I have just found out that when I create an HTML email using TIdMessageBuilderHtml and also want to attach a file using TIdAttachmentFile, the file attachment fails.
It does not make a difference in which order I do it.
Is there anything I can do to fix it?
When opening the saved file, no attachments. Obviousely also when I actually send it with SMTP.
I have just found out that when I create an HTML email using TIdMessageBuilderHtml and also want to attach a file using TIdAttachmentFile, the file attachment fails.
It does not make a difference in which order I do it.
Is there anything I can do to fix it?
Code:
with TIdMessageBuilderHtml.Create do
try
PlainText.Text := PlainBody;
Html.Text := HTMLBody;
FillMessage(IdMessage);
finally
Free;
end;
TIdAttachmentFile.Create(IdMessage.MessageParts, AAttachment);
idMessage.SaveToFile('msg.eml');
When opening the saved file, no attachments. Obviousely also when I actually send it with SMTP.