Korzystam z komponentów INDY w celu wysłania e-mail'a w formacie html z wyświetlanym w html obrazkiem + drugim załącznikiem dowolnego formatu.

Wszystko jest OK, oprócz wyświetlania obrazka "grafika.jpg" w html. Wyświetlany jest znany kwadracik z czerwonym krzyżykiem.

Szukam usilnie błędów w tym kodzie.

Co podejrzewam - znacznik cid, tagi < > przy content-id, charset
Nie udało mi się jeszcze rozgryźć tego.

Dziękuję za każdą pomoc, ale proszę powstrzymać się od nic niewzoszących uwag - zmień komponent, zmień system operacyjny czy coś :) Przeszukałem archiwum na 4p - był podobny temat, jednak nie pomógł. Przeszukałem torry.net i grupy dyskusyjne - bez powodzenia.

Załączam kod procedury + źródło wiadomości.

Kod w Delphi:

procedure TMainFrm.btnWyslijClick(Sender: TObject);
var
 i: Integer;
 HTMLPart, TXTPart: TIdText;
 JPEGPart: TIdAttachment;
begin

  SMTP.Host := 'xxxxxxxxx';
  SMTP.Port := 25;
  SMTP.MailAgent:= 'Outlook';
  SMTP.UserID:= 'xxxxxx';
  SMTP.Password:= 'xxxxxxxxx';
  SMTP.AuthenticationType := atLogin;
  
  MailMessage.From.Address := '[email protected]';
  MailMessage.From.Name := 'cos';
  MailMessage.Subject := 'temat';
  MailMessage.ContentType := 'multipart/mixed';
  MailMessage.CharSet:='ISO-8859-2';

  TXTPart := TIdText.Create(MailMessage.MessageParts);
  TXTPart.ContentType := 'text/plain';
  TXTPart.Body.Text := '';

     JPEGPart := TIdAttachment.Create(MailMessage.MessageParts, ExtractFileDir(Application.ExeName)
                         + '\grafika' + ExtractFileExt(sciezka_do_obrazu));
     JPEGPart.ContentType := 'image/jpeg';
     JPEGPart.ContentDisposition := 'inline';
     JPEGPart.ExtraHeaders.Values['content-id'] := '<grafika.jpg>';
     JPEGPart.DisplayName := 'grafika.jpg';

  HTMLPart := TIdText.Create(MailMessage.MessageParts, nil);
  HTMLPart.ContentType := 'text/html';
  HTMLPart.Body.Text := MHTML.Lines.Text;

  TIdAttachment.Create(MailMessage.MessageParts, 'sciezka_do_zalacznika');

 with MailMessage.BCCList.Add do
   begin
        Address := #60 + '[email protected]+ #62;
   end;


   with MailMessage.BCCList.Add do
   begin
        Address := #60 + '[email protected]' + #62;
   end;
  try
    try
      SMTP.Connect;
      SMTP.Authenticate();
      SMTP.Send(MailMessage);
    except on E:Exception do
     begin
      ShowMessage(E.Message);
     end;
    end;
  finally
    if SMTP.Connected then
      SMTP.Disconnect;
  end;
end;

Źródło wiadomości:

Return-path: <xxxxxxxxx>
Envelope-to: xxxxxx
Delivery-date: Wed, 20 Jul 2005 14:10:49 +0200
Received: from [xxxxxx] (helo=xxxxxxx)
	by xxxxxx with esmtp (Exim 4.50)
	id 1DvDPV-0003xe-2q
	for xxxxxxxx; Wed, 20 Jul 2005 14:10:49 +0200
Received: from xxxx (unknown [xxxxxxxxx])
	by xxxxxxx (Postfix) with ESMTP id 8593834004E;
	Wed, 20 Jul 2005 14:10:46 +0200 (CEST)
From: "NADAWCA" <xxxxxxxxxx>
Subject: TEMAT
Content-Type: multipart/related; type="multipart/alternative";
 boundary="=_NextPart_2relrfksadvnqindyw3nerasdf";ISO-8859-2
MIME-Version: 1.0
Date: Wed, 20 Jul 2005 14:10:55 +0200
X-Priority: 3
X-Library: Indy 8.0.25
X-Mailer: Outlook
Message-Id: <20050720121046.8593834004E@xxxxxxx>
To: undisclosed-recipients:;

This is a multi-part message in MIME format

--=_NextPart_2relrfksadvnqindyw3nerasdf
Content-Type: multipart/alternative; 
        boundary="=_NextPart_2altrfkindysadvnqw3nerasdf"

--=_NextPart_2altrfkindysadvnqw3nerasdf
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable


--=_NextPart_2altrfkindysadvnqw3nerasdf
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D=22Content-Type=22content=3D=22text/html=22; charset=3D=22iso-8859-2=22></head><body bgcolor=3D=22white=22>
<center><img src=3Dcid:=22grafika.jpg=22></center>
<font size=3D=224=22 color=3D=22black=22 face=3D=22Arial=22>
<br>LINIA 1
<br>LINIA 2
<br>
<br>LINIA 3
</font>
</body>
</hmtl>

--=_NextPart_2altrfkindysadvnqw3nerasdf--

--=_NextPart_2relrfksadvnqindyw3nerasdf
Content-Type: image/jpeg;
        name="grafika.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
        filename="grafika.jpg"
content-id: <grafika.jpg>

<tu długi ciąg literek> :)


--=_NextPart_2relrfksadvnqindyw3nerasdf
Content-Type: application/octet-stream;
        name="zalacznik.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        filename="zalacznik.doc"

<tu długi ciąg literek> :)

--=_NextPart_2relrfksadvnqindyw3nerasdf--