Re: Text file attachment.

Giganews Newsgroups
Subject: Re: Text file attachment.
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 22 Apr 2005

"Benitez Alejandro G. M." <us…@domain.invalid> wrote in message
news:786CB6AD17C8E240us…@domain.invalid...

> Is it possible to attach a text file and let it be text instead of
> base64 code in the message source ?

Indy 9 does not support per-attachment encodings.  Even though you can set
the TIdAttachment.ContentTransfer property to whatever you want, its value
is not actually used when encoding attachments.  The
TIdMessageParts.MessageEncoderInfo property is used instead, which means
that all attachments in a message are encoded the same way globally.  Base64
is the default encoding for attachments.

> The fact is that I'm using Indy and StreamSec Tools to create
> digitally signed documents. They are multi-part messages in MIME
> format. And I would like to keep the attachments human-readable.

All of the attachments?  If so, then you have several steps that you will
have to perform manually:

1) derive a new class from TIdMessageEncoder.  Override the Encode() method
to do the actual encoding of your choice.  You are provided source and
destination TStream objects to work with.

2) derive a new class from TIdMessageEncoderInfo.  Have its constructor set
the inherited FMessageEncoderClass member to the class type from step #1.
Have the unit call TIdMessageEncoderList.RegisterEncoder() in its
'initialization' section, specifying a unique name of your choosing to
identify your encoder classes.

3) you can now set the TIdMessage.AttachmentEncoding property to the
registered name from step #2.  The default AttachmentEncoding is 'MIME',
which uses base64 as its encoding algorithm.

Gambit

Replies

In response to

Text file attachment. posted by Benitez Alejandro G. M. on Fri, 22 Apr 2005