Re: create attachments from stream

Giganews Newsgroups
Subject: Re: create attachments from stream
Posted by:  slappyhack (slappyha…@gmail.com)
Date: Wed, 15 Mar 2006

This question was answered in another Forum the suggested answer is as follows:

PrepareTempStream() and FinishTempStream() methods, ie:

    var
        s: TIdStream;
    begin
        s := attachment.PrepareTempStream;
        try
            s.CopyFrom(YourSourceStream, 0);
        finally
            s := attachment.FinishTempStream;
        end;
    end;

> I posted this in coders:
>
> Delphi 2006 Indy 10 upgraded from delphi 7 and Indy 9
>
> I hope this is the correct place to ask this question so I'll give it a shot
> .  I am saving my message attachments to an array of streams as follows:
>
> type
>  TAttachment = record
>    mAttach: TMemoryStream;
>    mFilename: string;
>  end;
>
> arAttachment: array of TAttachment;
>
> TIdAttachment(TheMsg.MessageParts.Items[x]).SaveToStream(arAttachment[i].mAt
> tach);
>
>  for x := 0 to high(arAttachment) do
>  begin
>      DataQueue.LoadMsgObjToDB(arAttachment[x].mAttach, intMessageID, trim(st
> rTID), fstrSystem, trim(arAttachment[x].mFilename));
>  end;
>
> Then I am adding them to a binary field in informix this works fine the reco
> rds are all created.  The issue arise when I try to extract my attachments a
> nd attach them to a new message, I cannot find a method to load attachment f
> rom stream.
>
> I searched the web for samples but came across nothing but loading from file
> .
>
> thanks
>
> Jim

Replies

None

In response to

create attachments from stream posted by slappyhack on Wed, 15 Mar 2006