Re: MIME/SMTP deleting text
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: MIME/SMTP deleting text

From: Earl Grieda <egriedaNOT@ZAHOOyahooWAHOO.com>
Date: Sat Jul 02 2005 - 00:30:11 CEST

"Earl Grieda" <egriedaNOT@ZAHOOyahooWAHOO.com> wrote in message
news:nDJwe.11241$hK3.11111@newsread3.news.pas.earthlink.net...
> I am using the MIME/SMTP packages in, if not the latest, a very
> recent version of tcllib. For some reason it appears to be deleting
> text. I am sending a line with embedded HTML but I do not want it
> encoded as HTML. It is just text. The receiving program will take
> care of encoding the HTML. The problem is that either MIME or SMTP
> is deleting the text, see the before and after examples below. If
> I just use sendmail to mail the file then it is correctly received.
> This is on RH Linux 8.0 and tcl 8.4.5.
>
> Granted this is probably user error since the documentation for these
> packages is as clear as mud, but other than this area the packages seem
> to work fine. I also use these packages to encode the finished report
> as HTML and that also seems to work fine.
>
> File to be mailed:
> # Header definitions
> AI_HDR1_1 <B>Bold Header</B>
> AI_HDR3_2 <B>Header <a href="http://www.Some-web-site.com"> Without a
> tab</A></B>
> AI_HDR4_3 Header Without a tab
>
> File at Linux inbox (/var/spool/mail/guest)
> # Header definitions
> AI_HDR1_1 <B>Bold Header</B>
> AI_HDR3_2 <B>Header <a hreftab</A></B>
> AI_HDR4_3 Header <a href</A>
>
> Email proc, with some editing for clarity
>
> proc SendEmail {fileName to} {
>
> catch {
> set token [mime::initialize -canonical text/plain -file $fileName]
> smtp::sendmessage $token \
> -header [list To $to] \
> -header [list From $::WEB_TESTER] \
> -header [list Bcc $::ADMIN] \
> -header [list Subject "Header Info"]
> }
> mime::finalize $token
> } catchResult
> Log "$P CATCH: $catchResult"
> }
>

After much Google searching and experimenting I have either a fix, or a work
around. Either way the problem seems to be resolved. The line above:
  set token [mime::initialize -canonical text/plain -file $fileName]
needed to be enhanced with -encoding 8bit (or 7bit).
  set token [mime::initialize -canonical text/plain -encoding 8bit -file
$fileName]

This results in the received email having all text, such as:
  AI_HDR3_2 <B>Header Without a
tab</B>

versus
  AI_HDR3_2 <B>Header <a href> a tab</B>

In the example where the text is missing there is this line in the email
header:
  X-MIME-Autoconverted: from quoted-printable to 8bit

Apparently, if no encoding is specified then quoted-printable is used, and
for some reason that results in text deletion.
Received on Thu Sep 29 14:24:32 2005