🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1965

Re: TIdAttachment Problem with MIME Encoding

#1965
From: Remy Lebeau (TeamB)
Date: Thu, 21 Sep 2006 18:55
67 lines
3543 bytes
"Robert Lieblich" <nospam@nospam.com> wrote in message
news:4512da05@newsgroups.borland.com...

> I don't think that this is neccessary.

I wanted to see whether your message is malformed in general.  If it is,
then you are going to have other problems.

> That's not bad, but actually, as Hans noted, it does not care about
> the file itself.

Indy does not care about the actual file.  But the ContentType must match
what the actual data is, or else the receiver will not be able to interpret
the data properly.

> And, sometimes I want to send binary files with a .txt
> extension (why not? If it's just for me..).

You should not be sending binary data as text (unless the binary is textual
in nature, of course).  In any case, the ContentType must match the actual
file content that is being encoded inside the message.

> But I did some tests and all that I really want is to send any
> attachment unchanged (in a binary mode).

Which is easy to accomplish, using TIdAttachment.  But the ContentType must
still match the type of data being attached.

> So, with "image/jpg" or "application/x-zip-compressed" I could
> send all attachments I tried so far unchanged, and no additional
> bytes.

Those are specific ContentTypes for specific data formats.  You should not
be using them to send arbitrary binary data.  If you really want to do that,
then you have to use "application/octet-stream" instead (which is what Indy
defaults to for uknown types).

> And, could it be bad to transfer even a plain text attachment
> in this mode?

No.  That will work fine.  Text is just binary limited to a smaller range of
byte values, afterall.

> By the way, when you put the text message in a text-attachment like that:
>     ...
>     TIdText *text1 = new TIdText(IdMessage1->MessageParts, NULL);
>     text1->Body->Add("Some text...");
>     text1->ContentType = "text/plain";
>     ...
> and not in the IdMessage1->Body, it's not possible to use UUEncoding

Yes, it is.  Simply set the TIdMessage::Encoding property to meUU, which in
turn sets the AttachmentEncoding property to "UUE".

> Indy gives an errormessage that only a simple textmessage plus
> attachment are allowed in UU-mode

Then you are likely using an old version.

> And, in MIME mode, this text is ignored at the receiving mailserver
> (or the mailclient?)

Only if the message is malformed to begin with, or the receiver is buggy.


Gambit
Technical Details
Message-ID: <4512e0ae$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45112258$1@newsgroups.borland.com> <45117004$1@newsgroups.borland.com> <45118fd7$1@newsgroups.borland.com> <4511bc98$1@newsgroups.borland.com> <4512da05@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,edd2a3551c00f96a
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45112258$1@newsgroups.borland.com> <45117004$1@newsgroups.borland.com> <45118fd7$1@newsgroups.borland.com> <4511bc98$1@newsgroups.borland.com> <4512da05@newsgroups.borland.com>
Subject: Re: TIdAttachment Problem with MIME Encoding
Date: Thu, 21 Sep 2006 11:55:28 -0700
Lines: 69
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <4512e0ae$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158865070 69.169.4.232 (21 Sep 2006 11:57:50 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail