Re: Complex messageparts with indy ? Impossible ?

Giganews Newsgroups
Subject: Re: Complex messageparts with indy ? Impossible ?
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Thu, 20 Jan 2005

"Rémi Mévaere" <remiii…@free.fr> wrote in message
news:093BB28796BCE240remiii…@free.fr...

> How can i send this message, without TIDMESSAGE ?
> How can i create with tidmessage the line who have **** ?

You did not specify which version of Indy you are actually using.

If you are using Indy 9, then you cannot produce such a message unless you
produce the entire "multipart/alternative" section manually yourself inside
a single TIdText instance, for example:

    IdMessage1.From.Name := 'remi';
    IdMessage1.From.Address := 'df…@fd.fr';
    IdMessage1.Recipients.Add.Address := 'df…@fd.fr';
    IdMessage1.Subject := 'test oe';
    IdMessage1.Date := Now;

    with TIdText.Create(IdMessage1.MessageParts, nil) do
    begin
        ContentType := 'multipart/alternative';
        Body.Text := 'your entire multipart/alternative MIME data';
    end;

    with TIdAttachmentFile.Create(IdMessage1.MessageParts,
'c:\folder\1.gif') do
    begin
        ContentID := '<000301c4ff3a$bdc69270$0100a8c0@remi>';
        ContentTransfer := 'base64';
    end;

    with TIdAttachmentFile.Create(IdMessage1.MessageParts,
'c:\folder\2.gif') do
    begin
        ContentID := '<000401c4ff3a$bdc69270$0100a8c0@remi>';
        ContentTransfer := 'base64';
    end;

If you are using Indy 10, then you can use the ParentPart property of
TIdMessagePart to do what you are asking, for example:

    IdMessage1.From.Name := 'remi';
    IdMessage1.From.Address := 'df…@fd.fr';
    IdMessage1.Recipients.Add.Address := 'df…@fd.fr';
    IdMessage1.Subject := 'test oe';
    IdMessage1.Date := Now;

    with TIdText.Create(IdMessage1.MessageParts, nil) do
    begin
        ContentType := 'multipart/alternative';
        ParentPart := -1;
    end;

    with TIdText.Create(IdMessage1.MessageParts, nil) do
    begin
        Body.Text := 'your plain text here';
        CharSet := 'iso-8859-1';
        ContentTransfer := 'quoted-printable';
        ContentType := 'text/plain';
        ParentPart := 0;
    end;

    with TIdText.Create(IdMessage1.MessageParts, nil) do
    begin
        Body.Text := 'your html here';
        CharSet := 'iso-8859-1';
        ContentTransfer := 'quoted-printable';
        ContentType := 'text/html';
        ParentPart := 0;
    end;

    with TIdAttachmentFile.Create(IdMessage1.MessageParts,
'c:\folder\1.gif') do
    begin
        ContentID := '<000301c4ff3a$bdc69270$0100a8c0@remi>';
        ContentTransfer := 'base64';
        ParentPart := -1;
    end;

    with TIdAttachmentFile.Create(IdMessage1.MessageParts,
'c:\folder\2.gif') do
    begin
        ContentID := '<000401c4ff3a$bdc69270$0100a8c0@remi>';
        ContentTransfer := 'base64';
        ParentPart := -1;
    end;

Gambit

Replies

In response to

Complex messageparts with indy ? Impossible ? posted by Rémi Mévaere on Thu, 20 Jan 2005