Re: Attachment ContentType

Giganews Newsgroups
Subject: Re: Attachment ContentType
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Tue, 15 Mar 2005

"Robert Tulloch" <tulta…@attglobal.net> wrote in message
news:FA18E8594CC3E240tulta…@attglobal.net...

>    When I attach a pdf and an rtf using
<snip>
> I get:
<snip>

As well you should.  You did not set the ContentType for the attachments.

> Why using NS I get:

Because Netscape knows what the actual ContentType for a pdf file is so it
can fill it in.  You have to do the same in your own code.  Indy has a
GetMIMETypeFromFile() function that can do that for you, ie:

    with TIdAttachment.Create(IdMsgSend.MessageParts, OpenDialog.FileName)
do
    begin
        ContentType := GetMIMETypeFromFile(OpenDialog.FileName);
        // set other properties as needed...
    end;

Gambit

Replies

In response to

Attachment ContentType posted by Robert Tulloch on Tue, 15 Mar 2005