These are chat archives for IndySockets/Indy

Apr 2018
Apr 17 2018 12:59
I need to clone a completed TIdMessage object. How to do it correctly? Is SaveToStream / LoadFromStream enough?
Apr 17 2018 13:29
that should get most, if not all.
Remy Lebeau
Apr 17 2018 16:51
@jaclas that depends on how you have populated the TIdMessage, and what the values of the NoEncode and NoDecode properties are set to
Ludwig Behm
Apr 17 2018 18:26
I have a question about TIdMessage, too. I need to insert a TGraphic into a HTML-Mail. I assume I have to use TIdAttachmentMemory and reference the filename in the img-src?
More important: how would you import a TGraphic into a TIdAttachmentMemory?
Remy Lebeau
Apr 17 2018 18:36
@lbehm See and for how to produce HTML emails with embedded images. As for using TGraphic, you can save it to a TStream first, such as TMemoryStream, and then construct the TIdAttachmentMemory from that TStream. Or, you can save the TGraphic to a temp file and use TIdAttachmentFile with its FileIsTempFile property set to True so the file will be deleted when the attachment is freed. Or, you could write your own TIdAttachment class that overrides OpenLoadStream() and CloseLoadStream() to return/free a temp TStream that the TGraphic has been saved to and which Indy will read from to get the data to send.
Ludwig Behm
Apr 17 2018 18:38
Awesome, thank you!