Re: Store TIdAttachmentFile in a variable

Giganews Newsgroups
Subject: Re: Store TIdAttachmentFile in a variable
Posted by:  Remy Lebeau \(Indy Team\) (re…
Date: Mon, 21 Feb 2011

"Alexandre" <alexandrepires20…> wrote in message

> Remy, how store the text of a attachment in a variable ?

You will have to call the TIdAttachmentFile.SaveToStream() method to save
the data into a TMemoryStream or other suitable TStream of your choosing,
then you can copy the data from that as needed.

Alternatively, use TIdAttachmentMemory instead of TIdAttachmentFile (use the
TIdMessage.OnCreateAttachment event to create TIdAttachmentMemory objects
when loading emails).  Then you can use the TIdAttachmentMemory.DataStream
or TIdAttachmentMemory.DataString property as needed.

Remy Lebeau (TeamB)


In response to

Store TIdAttachmentFile in a variable posted by Alexandre on Mon, 21 Feb 2011