Is there a way that one can add a related attachment from memory instead of a file saved on disk using Indy's MessageBuilder?
I am adding a footer signature to my emails and the image is saved as a blob field in a database.
I can do this with IdMessage but MessageBuilder just makes everything so easier.
I am using Delphi XE7 and Indy 10.
TIdMessageBuilderAttachment
has a public Data: TStream
property, and TIdMessageBuilderAttachments
has an overloaded Add()
method with an AData: TStream
parameter.
If a TStream
is used for an attachment's data, the builder creates a TIdAttachmentMemory
and copies the stream data into it. Otherwise, the builder creates a TIdAttachmentFile
and assigns the specified filename to it.
So, you can obtain a TStream
for your blob data, such as from TDataSet.CreateBlobStream()
, and create an email attachment from that.