Re: attachment filename unreadable

Giganews Newsgroups
Subject: Re: attachment filename unreadable
Posted by:  Remy Lebeau \(Indy Team\) (no.spam@no.spam.com)
Date: Thu, 23 Nov 2006

"Alan Dodd" <alan.do…@tele2.it> wrote in message
news:D862F2688F10E340alan.do…@tele2.it...

> When I send a message with thunderbird with an attachment which
> has a filename of max 50 chars (+ extension) (example:'this is just a
> test with 50 characters in filename.pdf') in my prog I see the filename
> as  'this_is_just_a_test_with_50_characters_in_filename.pdf'

As you should be.  Spaces are not allowed in email file names, so they are
delimited when sent.

> If the attachment filename is longer, in my prog the filename is empty
> (but the body of the attachment is there, and I can save it to a file
> if I give it a file name)
>
> Not OK!

Your filename is too long.  There is nothing Indy can do about that.  Use
smaller file names.

> Content-Disposition: inline;
>  filename*0="this is just a test with 50 characters in filename.pdf"

That is a malformed header.  The "*0" is erroneous.

> Content-Type: application/pdf;
>  name*0="this is just a test with 51  characters in filename.pdf"

Again, that is malformed.

> Content-Disposition: inline;
>  filename*0="this is just a test with 51  characters in filename.pdf"

And that is malformed as well.

>      if (Mess.MessageParts.Items[intInd] is TIdAttachmentFile) then

You should use TIdAttachment generically instead of TIdAttachmentFile
specifically:

    if (Mess.MessageParts.Items[intInd] is TIdAttachment) then
    begin
        attfilename :=
TIdAttachment(Mess.MessageParts.Items[intInd]).FileName;
        ...
        TIdAttachment(Mess.MessageParts.Items[intInd]).SaveToStream(blobst);
        ...
    end;

> notice that in the source of the 'bad' message we have  name*0="this...
> instead of name="this...
>
> so I think it is Indy (10) that cannot cope with this format am I right?

That is correct.  Thunderbird is sending you malformed data.  There is
nothing Indy can do about that.

Gambit

Replies

In response to

attachment filename unreadable posted by Alan Dodd on Thu, 23 Nov 2006