Re: Store TIdAttachmentFile in a variable

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

"Alexandre" <alexandrepires20…@yahoo.com.br> wrote in message
news:CBED360072D2E340alexandrepires20…@yahoo.com.br...

> 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)

Replies

In response to

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