TidMessage Plan / HTML with Images and Attachment LoadFrom / SaveTo STREAM - USING INDY10

Giganews Newsgroups
Subject: TidMessage Plan / HTML with Images and Attachment LoadFrom / SaveTo STREAM - USING INDY10
Posted by:  Ant (adcru…@tickets_NOSPAM.com)
Date: Mon, 14 May 2007

Hi all,
it seems to me that using LoadFromStream SaveToStream with a TidMessage
screws up the email aa bit.

I ave messages to a VarBinary field in SQL server but when I retrieve them
and try to send, I fin that the HTML is not shown in outlook.

My message is OK because if I just send it without the database stuff, it
all comes in fine.

What could be my trouble?

This code is causing me trouble

if MessageDlg( 'Save and Load From DB' , mtConfirmation, [mbYes, mbNo], 0 )
= mrYes then
  begin
  if ADOQuery1.Active = false then
      ADOQuery1.Active := true;

  ADOQuery1.Insert;
  StrM := TMemoryStream.Create;
  Msg.SaveToStream( StrM );
  StrM.Seek( 0, soFrombeginning );
  ( ADOQuery1.FieldByName( 'Message' ) as TBlobField ).LoadFromStream(
StrM );
  ADOQuery1.FieldByName( 'EntryDate' ).Value := Now;
  ADOQuery1.Post;

  msg.Free;
  StrM.Free;

  StrM := TMemoryStream.create;
  ( ADOQuery1.FieldByName( 'Message' ) as TBlobField ).SaveToStream(
StrM );
  StrM.Seek( 0, soFromBeginning );
  msg := TIdMessage.Create;;
  StrM.Seek( 0, soFromBeginning );

  msg.LoadFromStream( StrM, false );
  end;

Replies