Question for Remy Lebeau about mail HTML and Attach

Giganews Newsgroups
Subject: Question for Remy Lebeau about mail HTML and Attach
Posted by:  Bruno Reato (lixnici…@hotmail.com)
Date: Fri, 9 Jan 2004

Remy:
I need send a mail with html format and a attach file, i saw a example in
this newsgroup yours like this:

    with TIdText.Create(IdMessage1.MessageParts, nil) do
    begin
        ContentType := 'text/html';
        // fill in the Body as needed
    end;

    with TIdAttachment.Create(IdMessage1.MessageParts, 'c:\somefile.jpg') do
    begin
        FileName := 'somefile.jpg';
        ContentType := 'image/jpeg';
    end;
    IdSMTP1.Connect;
    try
      IdSMTP1.Send(IdMessage1);
    finally
      IdSMTP1.Disconnect;
    end;
...
But i can't add both MessageParts (File and HTML), if i do this, send the
attach only, the HTML is blank. But if not send the attach (only the HTML
MessagePart) i can recieve it.

Thanks.
Bruno.

Replies