Re: Related Part Attachments - Bug? ...or am I just breaking it.

Giganews Newsgroups
Subject: Re: Related Part Attachments - Bug? ...or am I just breaking it.
Posted by:  Pierre Roux (pier…@infofx.co.za)
Date: Thu, 13 Jan 2005

Hi,

I am still playing around trying to find out how related Attachments work.
I stumbled upon the TIdMessagePart.ParentPart property, which made me very
hopefull.

The function 'FoldWrapText' in the IdHeaderList unit causes an 'Index Out of
Bounds' error as soon as I set the TIdMessagePart.ParentPart property.
Unfortunately I could not find out why yet, thus I am not sure if its my
code, or an actual problem.

I tried:
    msgPart.ParentPart            := msgText.Index;
and:
    msgPart.ParentPart            := 0;
as well as:
    msgPart.ParentPart            := msgText.ID;

All with the same result.

What does ParentPart do?  It doesn't seem to be documented. Maybe one of the
guru's can shed some light on it.

Regards,
  Pierre Roux

"Pierre Roux" <pier…@infofx.co.za> wrote in message
news:2707ED42AEBBE240pier…@infofx.co.za...
> Hi,
>
> Sorry for the double post.
>
> I'm trying to embed, for lack of a better term, images into a message with
a
> HTML body.  I get the message attached, the body is fine (CID in place),
but
> the images do not show in the mail client.
>
> How do you tell Indy to that a messagepart is related to another?  In
other
> words, that the Images is related to the HTML.  From the manual it hints
at
> the ClassType property, but I cannot make any sense of it and it is not
> described any further in the docs.
>
> I had a look at the output example below as originated from Holger Dors,
and
> that is what I am aiming to achieve.
>
> Code Snip:
>
>  // Message Body
>  msgText          := TIdText.Create(msgMessage.MessageParts);
>
>  msgText.ContentType          := 'text/html';
>  msgText.ContentTransfer      := 'quoted-printable';
>
>  msgText.Body.LoadFromFile(sTempSource);
>
>  for iCount := 0 to lImages.Count - 1 do
>      begin
>
>      try
>      msgPart  := TIdAttachmentFile.Create(msgMessage.MessageParts,
> RightStr(lImages.Strings[iCount], Length(lImages.Strings[iCount]) - 8));
>
>      msgPart.ContentType          := 'image/jpeg';
>      msgPart.ContentDisposition    := 'inline';
>      msgPart.ContentID            :=
> '<MSGPART000'+RightStr('000000'+IntToStr(iCount), 6)+'>';
>
>      except
>        On E:Exception do
>            ShowMessage('Could not attach image. Error '+E.Message);
>      end;
>
>      end;
>
> Using Delphi 7, Indy 10.0.20, need to update from Snapshot again...
>
> Regards and Thanks in advance,
>  Pierre Roux
>
> "Holger Dors" <do…@kittelberger.de> wrote in message
> news:opsizo7jbm4aye…@tpol.kittelberger.intra...
> > Hello,
> >
> > I'm using Indy 10.0.52 for generation of a fairly complex mail: it's an
> > HTML Mail with inline images, an plain text alternative and an
> > attachement. The generated message looks something like this:
> >
> > ----------------------- cut -----------------------
> >
> > Subject: Opera Test
> > Content-Type: multipart/mixed;
> > boundary="MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevS"
> > MIME-Version: 1.0
> > Date: Mon, 13 Dec 2004 17:45:28 +0100
> >
> > This is a multi-part message in MIME format
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevS
> > Content-Type: multipart/alternative;
> >          boundary="MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSf"
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSf
> > Content-Type: text/plain
> > Content-Transfer-Encoding: quoted-printable
> >
> > This is a test for Opera
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSf
> > Content-Type: multipart/related;
> >          boundary="MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSff"
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSff
> > Content-Type: text/html
> > Content-Transfer-Encoding: quoted-printable
> >
> > <html>
> > <head><title>Opera test</title></head>
> > <body>
> > <h1>This is a test for Opera.</h1>
> > <p>Here is an inline image:</p>
> > <img src=3D"cid:test">
> > </body>
> > </html>
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSff
> > Content-Type: image/gif;
> >          name="operalogo.gif"
> > Content-Transfer-Encoding: base64
> > Content-Disposition: inline;
> >          filename="operalogo.gif"
> > Content-ID: <test>
> >
> > [base64 portion trimmed]
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSff--
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSf--
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevS
> > Content-Type: application/zip;
> >          name="Jor's7.50setups.zip"
> > Content-Transfer-Encoding: base64
> > Content-Disposition: attachment;
> >          filename="Jor's7.50setups.zip"
> >
> > [base64 portion trimmed]
> >
> > --MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevS--
> >
> > ----------------------- cut -----------------------
> >
> > Now, Yngve Nysaeter Pettersen, a Opera developer, pointed this out:
> >
> > "[...] but the boundary
> >
> >    "MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSf"
> >
> > is a prefix of the boundary
> >
> >    "MYBCiajqohpCi=_AXx5Z34KYXyMbe9wevSff"
> >
> > The MIME RFCs  explicitly states that the sequence used for the boundary
> > MUST
> > NOT exist in any of the bodyparts which the boundary is used to
separate.
> >
> > RFC 2046:
> >
> >    The boundary delimiter MUST NOT appear inside any of the
encapsulated
> >    parts, on a line by itself or as the prefix of any line.  This
implies
> >    that it  is crucial that the composing agent be able to choose and
> >    specify a unique boundary parameter value that does not contain the
> >    boundary parameter value of an enclosing multipart as a prefix."
> >
> > Is this a known bug? Should/Could UI file a bug report? Or has this
fixed
> > in the current snapshot release already?
> >
> > Is there any way for me to correct this problem with Indy 10.0.52
myself,
> > in other words: can I explicitly set the boudary markers myself?
> >
> > Many thanks in advance,
> >    Holger Dors
> >

Replies

In response to

Related Part Attachments posted by Pierre Roux on Thu, 13 Jan 2005