Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Feb : Re: AlphaImageLoader?

www.cryer.info
Managed Newsgroup Archive

Re: AlphaImageLoader?

Subject:Re: AlphaImageLoader?
Posted by:"Richard Bibby" (richard.bib..@profdoc.com)
Date:Wed, 13 Feb 2008 15:00:02

hej,

I have downloaded Indy 10 and tried to implement my code as described.

However I get the same problem.  The image is attached but not displayed in
the message.

I am unable to change the html because is it created by Crystal Reports and
it does not have the cid syntax you refer to.

Everything worked ok until the html started to include the reference to the
AlphaImageLoader..... why should the html do that... is it dependant on the
environment?

I have included the code below.

procedure TForm1.Button3Click(Sender: TObject);
  var Mail : Tidmessage ;
      SMTP : TidSMTP ;
      OutputFilename, Attachment : string ;
      AttachFileName : string ;
      HTMLReport : TStringList ;
begin


  OutputFilename := 'c:\temp\connectrs\connectrs_status.html' ;
  Attachment :=
'c:\temp\connectrs\connectrs_status{DFB24CB9-6E0F-4F5E-8C43-FB938D9B97B1}.png'
;

  SMTP := TidSMTP.Create( nil ) ;
  try

    SMTP.Host := 'smtp.x.x' ;
    SMTP.Port := 25;

    Mail := TidMessage.Create ( nil );
    try

      Mail.From.Address := 'connectrs@x.com' ;
      Mail.Recipients.EMailAddresses := 'x@x.com' ;
      Mail.Subject := 'A test email';
      Mail.Body.Clear;

      Mail.ContentType := 'multipart/related; type="text/html"';

      HTMLreport := TStringList.Create ;
      try
        HTMLreport.LoadFromFile( Outputfilename );

        with TIdText.Create(Mail.MessageParts, nil) do
        begin
          Body.Text := HTMLREport.text ;
          ContentType := 'text/html';
        end;

      finally
        HTMLreport.Free ;
      end ;

      with TIdAttachmentFile.Create(Mail.MessageParts, Attachment ) do
      begin
        ContentType := 'image/png' ;
        AttachFileName := ExtractFilename( Attachment );
        ContentID := AttachFileName ;
        FileName := AttachFileName ;
      end;

      SMTP.Connect ;
      SMTP.Send(Mail);
      if SMTP.Connected then SMTP.Disconnect;

    finally
      Mail.Free ;
    end ;

  finally
    SMTP.Free ;
  end ;

end;


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:47b1ee37$1@newsgroups.borland.com...
>
> "Richard Bibby" <richard.bibby@profdoc.com> wrote in message
> news:47b161da@newsgroups.borland.com...
>
>> Does Indy 10 for Delphi 6 contain the TIdMessageBuilderHtml
>> class you mention in your articule?
>
> The class is a recent addition to the current snapshot.  It did not exist
> in any version of Indy that was bundled with any IDE version.
>
>
> Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive