Return-Path: bluepeak.westend.com!popeye
Return-Path: <popeye@bluepeak.westend.com>
Received: from popeye.bluepeak.westend.com by bluepeak  with smtp
	(Smail3.2 #1) id m1121ZR-00027XC; Thu, 8 Jul 1999 01:57:45 +0200 (MEST)
Received: from genesis for a.kupries
 with Cubic Circle's cucipop (v1.10 1996/09/06) Thu Jul  8 01:52:48 1999
X-From_: mrose@dbc.mtview.ca.us  Thu Jul  8 01:48:37 1999
Received: from smtp1-alterdial.uu.net (smtp1-alterdial.uu.net [192.48.96.19])
	by genesis.westend.com (8.8.6/8.8.6) with ESMTP id BAA23464
	for <a.kupries@westend.com>; Thu, 8 Jul 1999 01:48:30 +0200 (MET DST)
Received: from pixymisa by smtp1-alterdial.uu.net with SMTP 
	(peer crosschecked as: [207.247.127.238])
	id QQgwxb12787;
	Wed, 7 Jul 1999 23:48:26 GMT
From: "Marshall Rose" <mrose@dbc.mtview.ca.us>
To: "Andreas Kupries" <a.kupries@westend.com>
Cc: "Marshall Rose" <mrose@dbc.mtview.ca.us>
Subject: update
Date: Wed, 7 Jul 1999 17:48:24 -0600
Message-ID: <000001bec8d3$340a56a0$02c8a8c0@dbc.mtview.ca.us>
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_0001_01BEC8A0.E96FE6A0"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300

This is a multi-part message in MIME format.

------=_NextPart_000_0001_01BEC8A0.E96FE6A0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0002_01BEC8A0.E96FE6A0"


------=_NextPart_001_0002_01BEC8A0.E96FE6A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

hi. found a couple of little problems in b64code.c and qpcode.c - so here's
a new zipfile. only those two files have changed.

i have everything running now except for mime::sendmessage, which i haven't
coded. here's the new readme file (in both .txt and .html)

thanks!

/mtr


------=_NextPart_001_0002_01BEC8A0.E96FE6A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Comic Sans MS"><SPAN class=3D680052823-07071999>hi. =
found a=20
couple of little problems in b64code.c and qpcode.c - so here's a new =
zipfile.=20
only those two files have changed.</SPAN></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN class=3D680052823-07071999>i =
have everything=20
running now except for mime::sendmessage, which i haven't coded. here's =
the new=20
readme file (in both .txt and .html)</SPAN></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999>thanks!</SPAN></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999>/mtr</SPAN></FONT></DIV>
<DIV><FONT face=3D"Comic Sans MS"><SPAN=20
class=3D680052823-07071999></SPAN></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_001_0002_01BEC8A0.E96FE6A0--

------=_NextPart_000_0001_01BEC8A0.E96FE6A0
Content-Type: application/x-zip-compressed;
	name="trfupdate.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="trfupdate.zip"

[encoded data, 17710 characters]
bmVyaWMvcXBjb2RlLmNQSwUGAAAAAAUABQBkAQAA4DEAAAAA

------=_NextPart_000_0001_01BEC8A0.E96FE6A0
Content-Type: text/html;
	name="README.html"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="README.html"

<html><head><title>MIME Tcl</title>
<STYLE type=3D'text/css'>
    .title { color: #990000; font-size: 22px; line-height: 22px; =
font-weight: bold; text-align: right;
             font-family: helvetica, arial, sans-serif }
    .filename { color: #666666; font-size: 18px; line-height: 28px; =
font-weight: bold; text-align: right;
                  font-family: helvetica, arial, sans-serif }
    p.copyright { color: #000000; font-size: 10px;
                  font-family: verdana, charcoal, helvetica, arial, =
sans-serif }
    p { margin-left: 2em; margin-right: 2em; }
    ol { margin-left: 2em; margin-right: 2em; }
    ul.text { margin-left: 2em; margin-right: 2em; }
    pre { margin-left: 3em; color: #333333 }
    ul.toc { color: #000000; line-height: 16px;
             font-family: verdana, charcoal, helvetica, arial, =
sans-serif }
    H3 { color: #333333; font-size: 16px; line-height: 16px; =
font-family: helvetica, arial, sans-serif }
    H4 { color: #000000; font-size: 14px; font-family: helvetica, arial, =
sans-serif }
    TD.header { color: #ffffff; font-size: 10px; font-family: arial, =
helvetica, san-serif; valign: top }
    TD.author-text { color: #000000; font-size: 10px;
                     font-family: verdana, charcoal, helvetica, arial, =
sans-serif }
    TD.author { color: #000000; font-weight: bold; margin-left: 4em; =
font-size: 10px; font-family: verdana, charcoal, helvetica, arial, =
sans-serif }
    A:link { color: #990000; font-size: 10px; text-transform: uppercase; =
font-weight: bold;
             font-family: MS Sans Serif, verdana, charcoal, helvetica, =
arial, sans-serif }
    A:visited { color: #333333; font-weight: bold; font-size: 10px; =
text-transform: uppercase;
                font-family: MS Sans Serif, verdana, charcoal, =
helvetica, arial, sans-serif }
    A:name { color: #333333; font-weight: bold; font-size: 10px; =
text-transform: uppercase;
             font-family: MS Sans Serif, verdana, charcoal, helvetica, =
arial, sans-serif }
    .link2 { color:#ffffff; font-weight: bold; text-decoration: none;
             font-family: monaco, charcoal, geneva, MS Sans Serif, =
helvetica, monotype, verdana, sans-serif;
             font-size: 9px }
    .RFC { color:#666666; font-weight: bold; text-decoration: none;
           font-family: monaco, charcoal, geneva, MS Sans Serif, =
helvetica, monotype, verdana, sans-serif;
           font-size: 9px }
    .hotText { color:#ffffff; font-weight: normal; text-decoration: =
none;
               font-family: charcoal, monaco, geneva, MS Sans Serif, =
helvetica, monotype, verdana, sans-serif;
               font-size: 9px }
</style>
</head>
<body bgcolor=3D"#ffffff"alink=3D"#000000" vlink=3D"#666666" =
link=3D"#990000">
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<table width=3D"66%" border=3D"0" cellpadding=3D"0" =
cellspacing=3D"0"><tr><td><table width=3D"100%" border=3D"0" =
cellpadding=3D"2" cellspacing=3D"1">
<tr valign=3D"top"><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">README file</td><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">M.T. Rose</td></tr>
<tr valign=3D"top"><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">README</td><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">Dover Beach Consulting, Inc.</td></tr>
<tr valign=3D"top"><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">&nbsp;</td><td width=3D"33%" bgcolor=3D"#666666" =
class=3D"header">June 1999</td></tr>
</table></td></tr></table>
<div align=3D"right"><font face=3D"monaco, MS Sans Serif" =
color=3D"#990000" size=3D"+3"><b><br><span class=3D"title">MIME =
Tcl</span></b></font></div>
<font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<h3>Abstract</h3>

<p>
MIME Tcl generates and parses MIME body parts.
</p>
<a name=3D"toc"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>Table of Contents</h3>
<ul compact class=3D"toc">
<b><a href=3D"#anchor1">1.</a>&nbsp;
SYNOPSIS<br></b>
<b><a href=3D"#anchor2">1.1</a>&nbsp;
Requirements<br></b>
<b><a href=3D"#anchor3">1.2</a>&nbsp;
Copyrights<br></b>
<b><a href=3D"#anchor4">2.</a>&nbsp;
SYNTAX<br></b>
<b><a href=3D"#anchor5">3.</a>&nbsp;
SEMANTICS<br></b>
<b><a href=3D"#mime_initialize">3.1</a>&nbsp;
mime::initialize<br></b>
<b><a href=3D"#mime_finalize">3.2</a>&nbsp;
mime::finalize<br></b>
<b><a href=3D"#mime_getproperty">3.3</a>&nbsp;
mime::getproperty<br></b>
<b><a href=3D"#mime_getheader">3.4</a>&nbsp;
mime::getheader<br></b>
<b><a href=3D"#mime_setheader">3.5</a>&nbsp;
mime::setheader<br></b>
<b><a href=3D"#mime_getbody">3.6</a>&nbsp;
mime::getbody<br></b>
<b><a href=3D"#mime_copymessage">3.7</a>&nbsp;
mime::copymessage<br></b>
<b><a href=3D"#mime_sendmessage">3.8</a>&nbsp;
mime::sendmessage<br></b>
<b><a href=3D"#mime_parseaddress">3.9</a>&nbsp;
mime::parseaddress<br></b>
<b><a href=3D"#mime_parsedatetime">3.10</a>&nbsp;
mime::parsedatetime<br></b>
<b><a href=3D"#anchor6">4.</a>&nbsp;
EXAMPLES<br></b>
<b><a href=3D"#rfc.references">&#167;</a>&nbsp;
References<br></b>
<b><a href=3D"#rfc.authors">&#167;</a>&nbsp;
Author's Address<br></b>
<b><a href=3D"#anchor7">A.</a>&nbsp;
Acknowledgements<br></b>
</ul>
<br clear=3D"all">

<a name=3D"anchor1"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>1.&nbsp;SYNOPSIS</h3>
</font><pre>
    package provide mime 1.0
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
MIME Tcl is an implementation of a Tcl package that generates and
parses <a href=3D"#RFC2045">MIME</a>[1] body parts.
</p>

<p>
Each MIME part consists of a header
(zero or more key/value pairs),=20
an empty line,
and a structured body.
A MIME part is either a "leaf" or has (zero or more) subordinates.
</p>

<p>
MIME defines four keys that may appear in the headers:

<blockquote class=3D"text"><dl>

<dt>   Content-Type:</dt>
<dd>
describes the data contained in the body
("the content");
</dd>

<dt>   Content-Transfer-Encoding:</dt>
<dd>
describes how the content is
encoded for transmission in an ASCII stream;
</dd>

<dt>   Content-Description:</dt>
<dd>
a textual description of the
content; and,
</dd>

<dt>   Content-ID:</dt>
<dd>
a globally-unique identifier for the
content.
</dd>

</dl></blockquote>

</p>

<p>
Consult <a href=3D"#RFC2046">[2]</a> for a list of standard content =
types.
Further,
consult <a href=3D"#RFC822">[3]</a> for a list of several other header =
keys
(e.g., "To", "cc", etc.)
</p>

<p>
A simple example might be:
</p>
</font><pre>
    Date: Sun, 04 July 1999 10:38:25 -0600
    From: Marshall Rose &lt;mrose@dbc.mtview.ca.us>
    To: Andreas Kupries &lt;a.kupries@westend.com>
    cc: dnew@messagemedia.com (Darren New)
    MIME-Version: 1.0
    Content-Type: text/plain; charset=3D"us-ascii"
    Content-Description: a simple example
    Content-ID: &lt;4294407315.931384918.1@dbc.mtview.ca.us>
   =20
    Here is the body. In this case, simply plain text.
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<h4><a name=3D"anchor2">1.1</a>&nbsp;Requirements</h4>

<p>
This package requires:

<ul class=3D"text">

<li>
<a href=3D"http://www.scriptics.com/software/8.1.html">Tcl/Tk version =
8.0</a>
</li>

<li>
<a href=3D"http://www.oche.de/~akupries/soft/trf/">Trf version 1.8</a>
</li>

</ul>

</p>

<h4><a name=3D"anchor3">1.2</a>&nbsp;Copyrights</h4>

<p>
(c) 1999 Marshall T. Rose
</p>

<p>
Hold harmless the author, and any lawful use is unconstrained.
</p>

<a name=3D"anchor4"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>2.&nbsp;SYNTAX</h3>

<p>
<a href=3D"#mime_initialize">mime::initialize</a>
returns token.
Parameters:
</p>
</font><pre>    ?-canonical type/subtype
        ?-param    {key value}?...
        ?-encoding value?
        ?-header   {key value}?... ?
    (-file name | -string value | -parts {token1 ... tokenN})
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_finalize">mime::finalize</a> returns empty.
Parameters:
</p>
</font><pre>    token ?-subordinates "all" | "dynamic" | "none"?
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_getproperty">mime::getproperty</a>
returns string or list of string.
Parameters:
</p>
</font><pre>    token ?property | -names?
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_getheader">mime::getheader</a> returns
list of string.
Parameters:
</p>
</font><pre>    token ?key | -names?
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_setheader">mime::setheader</a> returns
list of string.
Parameters:
</p>
</font><pre>    token key value ?-mode "write" | "append" | "delete"?
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_getbody">mime::getbody</a> returns string.
Parameters:
</p>
</font><pre>    ?-command callback ?-blocksize octets? ?
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_copymessage">mime::copymessage</a>
returns empty.
Parameters:
</p>
</font><pre>    token channel
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_sendmessage">mime::sendmessage</a>
returns empty.
Parameters:
</p>
</font><pre>    token ?-server list?       ?-queue boolean?
          ?-atleastone boolean?
          ?-originator string? ?-recipients string?
          ?-header {key value}?...
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_parseaddress">mime::parseaddress</a>
returns list of array.
Parameters:
</p>
</font><pre>    string
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
<a href=3D"#mime_parsedatetime">mime::parsedatetime</a>
returns string.
Parameters:
</p>
</font><pre>    [string | -now] property
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<a name=3D"anchor5"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>3.&nbsp;SEMANTICS</h3>

<h4><a name=3D"mime_initialize">3.1</a>&nbsp;mime::initialize</h4>

<p>
mime::initialize creates a MIME part:

<ul class=3D"text">

<li>
If the -canonical option is present,
then the body is in canonical (raw) form and is found by consulting
either the -file, -string, or -part option.
<br>
<br>

In addition,
both the -param and -header options may occur zero or more times to
specify "Content-Type" parameters (e.g., "charset")
and header keyword/values (e.g., "Content-Disposition"),
respectively.
<br>
<br>

Also, -encoding, if present,
specifies the "Content-Transfer-Encoding" when copying the body.
</li>

<li>
If the -canonical option is not present,
then the MIME part contained in either the -file or the -string option
is parsed,
dynamically generating subordinates as appropriate.
</li>

</ul>

</p>

<h4><a name=3D"mime_finalize">3.2</a>&nbsp;mime::finalize</h4>

<p>
mime::finalize destroys a MIME part.
</p>

<p>
If the -subordinates option is present,
it specifies which subordinates should be also be destroyed.
The default value is "dynamic".
</p>

<h4><a name=3D"mime_getproperty">3.3</a>&nbsp;mime::getproperty</h4>

<p>
mime::getproperty returns the properties of a MIME part.
</p>

<p>
There are four properties: "content", "encoding", "params", and "parts".
The "parts" property is present only if the MIME part has subordinates.
</p>

<p>
If mime::getproperty is invoked with the name of a specific property,
then the corresponding value is returned;
instead,
if -names is specified,
a list of all properties is returned;
otherwise,
a serialized array of properties and values is returned.
</p>

<h4><a name=3D"mime_getheader">3.4</a>&nbsp;mime::getheader</h4>

<p>
mime::getheader returns the header of a MIME part.
</p>

<p>
A header consists of zero or more key/value pairs.
Each value is a list containing one or more strings.
</p>

<p>
If mime::getheader is invoked with the name of a specific key,
then the corresponding value is returned;
instead,
if -names is specified,
a list of all keys is returned;
otherwise,
a serialized array of keys and values is returned.
</p>

<h4><a name=3D"mime_setheader">3.5</a>&nbsp;mime::setheader</h4>

<p>
mime::setheader writes, appends to, or deletes the value associated
with a key in the header.
</p>

<p>
The value for -mode is one of:

<blockquote class=3D"text"><dl>

<dt>   write:</dt>
<dd>
 the key/value is either created or
overwritten (the default);
</dd>

<dt>   append:</dt>
<dd>
 a new value is appended for the key
(creating it as necessary); or,
</dd>

<dt>   delete:</dt>
<dd>
 all values associated with the key are removed
(the "value" parameter is ignored).
</dd>

</dl></blockquote>

</p>

<p>
Regardless,
mime::setheader returns the previous value associated with the key.
</p>

<h4><a name=3D"mime_getbody">3.6</a>&nbsp;mime::getbody</h4>

<p>
mime::getbody returns the body of a leaf MIME part in canonical form.
</p>

<p>
If the -callback option is present,
then it is repeatedly invoked with a fragment of the body as this:
</p>
</font><pre>
    uplevel #0 $callback [list "data" $fragment]
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
(The -blocksize option,
if present,
specifies the maximum size of each fragment passed to the
callback.)
</p>

<p>
When the end of the body is reached,
the callback is invoked as:
</p>
</font><pre>
    uplevel #0 $callback "end"
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
The return value of the callback is returned by
mime::getbody.
</p>

<p>
Alternatively,
if an error occurs,
the callback is invoked as:
</p>
</font><pre>
    uplevel #0 $callback [list "error" reason]
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
After the callback returns,
the error is propagated back by mime::getbody.
</p>

<p>
If the -callback option is absent,
then the return value of mime::getbody is a string containing the MIME
part's entire body.
</p>

<h4><a name=3D"mime_copymessage">3.7</a>&nbsp;mime::copymessage</h4>

<p>
mime::copymessage copies the MIME part to the specified channel.
</p>

<p>
mime::copymessage operates synchronously,
and uses vwait to allow asynchronous operations to proceed
independently.
</p>

<h4><a name=3D"mime_sendmessage">3.8</a>&nbsp;mime::sendmessage</h4>

<p>
mime::sendmessage sends a MIME part to an SMTP server.
</p>

<p>
The options are:

<blockquote class=3D"text"><dl>

<dt>   -server:</dt>
<dd>
a list of SMTP servers
(the default is "localhost");
</dd>

<dt>   -queue:</dt>
<dd>
indicates that the SMTP server should queue the
message for later processing;
</dd>

<dt>   -atleastone:</dt>
<dd>
indicates that the SMTP server must find
accept at least one recipient for the message to be sent;
</dd>

<dt>   -originator:</dt>
<dd>
a string containing an 822-style address
specification;
</dd>

<dt>   -recipients:</dt>
<dd>
a string containing one or more 822-style
address specifications; and,
</dd>

<dt>   -header:</dt>
<dd>
a keyword/value pairing
(may occur zero or more times).
</dd>

</dl></blockquote>

</p>

<p>
If the -originator option is not present,
the originator address is taken from "From" (or "Resent-From");
similarly,
if the -recipients option is not present,
recipient addresses are taken from "To", "cc", and "Bcc" (or
"Resent-To", and so on).
</p>

<p>
mime::sendmessage adds headers as necessary to ensure that a valid
822-style message is sent.
</p>

<h4><a name=3D"mime_parseaddress">3.9</a>&nbsp;mime::parseaddress</h4>

<p>
mime::parseaddr takes a string containing one or more 822-style
address specifications and returns a list of serialized arrays,
one element for each address specified in the argument.
</p>

<p>
Each serialized array contains these properties:
</p>
</font><pre>
    property    value
    =3D=3D=3D=3D=3D=3D=3D=3D    =3D=3D=3D=3D=3D
    address     local@domain
    comment     822-style comment
    domain      the domain part (rhs)
    error       non-empty on a parse error=20
    group       this address begins a group
    friendly    user-friendly rendering
    local       the local part (lhs)
    memberP     this address belongs to a group
    phrase      the phrase part
    proper      822-style address specification
    route       822-style route specification (obsolete)
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<p>
Note that one or more of these properties may be empty.
</p>

<h4><a =
name=3D"mime_parsedatetime">3.10</a>&nbsp;mime::parsedatetime</h4>

<p>
mime::parsedatetime takes a string containing an 822-style
date-time specification and returns the specified property.
</p>

<p>
The list of properties and their ranges are:
</p>
</font><pre>
    property     range
    =3D=3D=3D=3D=3D=3D=3D=3D     =3D=3D=3D=3D=3D
    hour         0 .. 23
    lmonth       January, February, ..., December
    lweekday     Sunday, Monday, ... Saturday
    mday         1 .. 31
    min          0 .. 59
    mon          1 .. 12
    month        Jan, Feb, ..., Dec
    proper       822-style date-time specification
    rclock       elapsed seconds between then and now
    sec          0 .. 59
    wday         0 .. 6 (Sun .. Mon)
    weekday      Sun, Mon, ..., Sat
    yday         1 .. 366
    year         1900 ...
    zone         -720 .. 720 (minutes east of GMT)
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">

<a name=3D"anchor6"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>4.&nbsp;EXAMPLES</h3>
</font><pre>
package require mime 1.0


# create an image

set imageT [mime::initialize -canonical image/gif \
                             -file logo.gif]


# parse a message

set messageT [mime::initialize -file example.msg]


# recursively traverse a message looking for primary recipients

proc traverse {token} {
    set result ""

# depth-first search
    if {![catch { mime::getproperty $token parts } parts]} {
        foreach part $parts {
	    set result [concat $result [traverse $part]]
	}
    }

# one value for each line occuring in the header
    foreach value [mime::getheader $token To] {
        foreach addr [mime::parseaddress $value] {
	    catch { unset aprops }
	    array set aprops $addr
	    lappend result $aprops(address)
	}
    }

    return $result
}


# create a multipart containing both, and a timestamp

set multiT [mime::initialize -canonical multipart/mixed
                             -parts [$imageT $messageT]]



# send it to some friends

mime::sendmessage $multiT \
      -header From "Marshall Rose &lt;mrose@dbc.mtview.ca.us>"
      -header To "Andreas Kupries &lt;a.kupries@westend.com>"
      -header cc "dnew@messagemedia.com (Darren New)"
      -header Subject "test message..."


# clean everything up

mime::finalize $multiT -subordinates all
</pre><font face=3D"verdana, helvetica, arial, sans-serif" size=3D"2">
<a name=3D"rfc.references"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>References</h3>
<table width=3D"99%" border=3D"0">
<tr><td class=3D"author-text" valign=3D"top"><b><a =
name=3D"RFC2045">[1]</a></b></td>
<td class=3D"author-text"><a href=3D"mailto:ned@innosoft.com">Freed, =
N.</a> and <a href=3D"mailto:nsb@messagemedia.com">N.S. Borenstein</a>, =
"<a =
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc2045.txt">Mult=
ipurpose Internet Mail Extensions (MIME)
Part One: Format of Internet Message Bodies</a>", RFC 2045, November =
1996.</td></tr>
<tr><td class=3D"author-text" valign=3D"top"><b><a =
name=3D"RFC2046">[2]</a></b></td>
<td class=3D"author-text"><a href=3D"mailto:ned@innosoft.com">Freed, =
N.</a> and <a href=3D"mailto:nsb@messagemedia.com">N.S. Borenstein</a>, =
"<a =
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc2046.txt">Mult=
ipurpose Internet Mail Extensions (MIME)
Part Two: Media Types</a>", RFC 2046, November 1995.</td></tr>
<tr><td class=3D"author-text" valign=3D"top"><b><a =
name=3D"RFC822">[3]</a></b></td>
<td class=3D"author-text"><a =
href=3D"mailto:DCrocker@UDel-Relay">Crocker, D.</a>, "<a =
href=3D"http://info.internet.isi.edu/in-notes/rfc/files/rfc822.txt">Stand=
ard for the format of ARPA Internet Text Messages</a>", RFC 822, STD 11, =
August 1982.</td></tr>
</table>

<a name=3D"rfc.authors"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>Author's Address</h3>
<table width=3D"99%" border=3D"0" cellpadding=3D"0" cellspacing=3D"0">
<tr><td class=3D"author-text">&nbsp;</td>
<td class=3D"author-text">Marshall T. Rose</td></tr>
<tr><td class=3D"author-text">&nbsp;</td>
<td class=3D"author-text">Dover Beach Consulting, Inc.</td></tr>
<tr><td class=3D"author-text">&nbsp;</td>
<td class=3D"author-text">POB 960</td></tr>
<tr><td class=3D"author-text">&nbsp;</td>
<td class=3D"author-text">Denver, CO  80201-0960</td></tr>
<tr><td class=3D"author-text">&nbsp;</td>
<td class=3D"author-text">US</td></tr>
<tr><td class=3D"author" align=3D"right">Phone:&nbsp;</td>
<td class=3D"author-text">+1 303 382 1260</td></tr>
<tr><td class=3D"author" align=3D"right">Fax:&nbsp;</td>
<td class=3D"author-text">+1 303 382 1264</td></tr>
<tr><td class=3D"author" align=3D"right">EMail:&nbsp;</td>
<td class=3D"author-text"><a =
href=3D"mailto:mrose@dbc.mtview.ca.us">mrose@dbc.mtview.ca.us</a></td></t=
r>
</table>

<a name=3D"anchor7"><br><hr size=3D"1" shade=3D"0"></a>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"2" width=3D"30" =
height=3D"15" align=3D"right"><tr><td bgcolor=3D"#990000" =
align=3D"center" width=3D"30" height=3D"15"><a href=3D"#toc" =
CLASS=3D"link2"><font face=3D"monaco, MS Sans Serif" color=3D"#ffffff" =
size=3D"1"><b>&nbsp;TOC&nbsp;</b></font></a><br></td></tr></table>
<h3>Appendix A.&nbsp;Acknowledgements</h3>

<p>
This package is influenced by the safe-tcl package
(Borenstein and Rose, circa 1993),
and also by <a href=3D"mailto:dnew@messagemedia.com">Darren New</a>'s
unpublished package of 1999.
</p>

<p>
This package makes use of=20
<a href=3D"mailto:a.kupries@westend.com">Andreas Kupries</a>'s
excellent Trf package.
</p>
</font></body></html>

------=_NextPart_000_0001_01BEC8A0.E96FE6A0
Content-Type: text/plain;
	name="README.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="README.txt"



README file                                                    M.T. Rose
README                                      Dover Beach Consulting, Inc.
                                                               June 1999


                                MIME Tcl


Abstract

   MIME Tcl generates and parses MIME body parts.

Table of Contents

   1.   SYNOPSIS . . . . . . . . . . . . . . . . . . . . . . . . . .   2
   1.1  Requirements . . . . . . . . . . . . . . . . . . . . . . . .   2
   1.2  Copyrights . . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.   SYNTAX . . . . . . . . . . . . . . . . . . . . . . . . . . .   4
   3.   SEMANTICS  . . . . . . . . . . . . . . . . . . . . . . . . .   5
   3.1  mime::initialize . . . . . . . . . . . . . . . . . . . . . .   5
   3.2  mime::finalize . . . . . . . . . . . . . . . . . . . . . . .   5
   3.3  mime::getproperty  . . . . . . . . . . . . . . . . . . . . .   5
   3.4  mime::getheader  . . . . . . . . . . . . . . . . . . . . . .   5
   3.5  mime::setheader  . . . . . . . . . . . . . . . . . . . . . .   6
   3.6  mime::getbody  . . . . . . . . . . . . . . . . . . . . . . .   6
   3.7  mime::copymessage  . . . . . . . . . . . . . . . . . . . . .   7
   3.8  mime::sendmessage  . . . . . . . . . . . . . . . . . . . . .   7
   3.9  mime::parseaddress . . . . . . . . . . . . . . . . . . . . .   8
   3.10 mime::parsedatetime  . . . . . . . . . . . . . . . . . . . .   8
   4.   EXAMPLES . . . . . . . . . . . . . . . . . . . . . . . . . .   9
        References . . . . . . . . . . . . . . . . . . . . . . . . .  11
        Author's Address . . . . . . . . . . . . . . . . . . . . . .  11
   A.   Acknowledgements . . . . . . . . . . . . . . . . . . . . . .  12



















Rose                                                            [Page 1]
=0C
README                          MIME Tcl                       June 1999


1. SYNOPSIS

       package provide mime 1.0

   MIME Tcl is an implementation of a Tcl package that generates and
   parses MIME[1] body parts.

   Each MIME part consists of a header (zero or more key/value pairs),
   an empty line, and a structured body. A MIME part is either a "leaf"
   or has (zero or more) subordinates.

   MIME defines four keys that may appear in the headers:=20

      Content-Type: describes the data contained in the body ("the
      content");

      Content-Transfer-Encoding: describes how the content is encoded
      for transmission in an ASCII stream;

      Content-Description: a textual description of the content; and,

      Content-ID: a globally-unique identifier for the content.

   Consult [2] for a list of standard content types. Further, consult
   [3] for a list of several other header keys (e.g., "To", "cc", etc.)

   A simple example might be:

       Date: Sun, 04 July 1999 10:38:25 -0600
       From: Marshall Rose <mrose@dbc.mtview.ca.us>
       To: Andreas Kupries <a.kupries@westend.com>
       cc: dnew@messagemedia.com (Darren New)
       MIME-Version: 1.0
       Content-Type: text/plain; charset=3D"us-ascii"
       Content-Description: a simple example
       Content-ID: <4294407315.931384918.1@dbc.mtview.ca.us>

       Here is the body. In this case, simply plain text.

1.1 Requirements

   This package requires:=20

   o  Tcl/Tk version 8.0[4]

   o  Trf version 1.8[5]





Rose                                                            [Page 2]
=0C
README                          MIME Tcl                       June 1999


1.2 Copyrights

   (c) 1999 Marshall T. Rose

   Hold harmless the author, and any lawful use is unconstrained.














































Rose                                                            [Page 3]
=0C
README                          MIME Tcl                       June 1999


2. SYNTAX

   mime::initialize (Section 3.1) returns token. Parameters:
       ?-canonical type/subtype
           ?-param    {key value}?...
           ?-encoding value?
           ?-header   {key value}?... ?
       (-file name | -string value | -parts {token1 ... tokenN})

   mime::finalize (Section 3.2) returns empty. Parameters:
       token ?-subordinates "all" | "dynamic" | "none"?

   mime::getproperty (Section 3.3) returns string or list of string.
   Parameters:
       token ?property | -names?

   mime::getheader (Section 3.4) returns list of string. Parameters:
       token ?key | -names?

   mime::setheader (Section 3.5) returns list of string. Parameters:
       token key value ?-mode "write" | "append" | "delete"?

   mime::getbody (Section 3.6) returns string. Parameters:
       ?-command callback ?-blocksize octets? ?

   mime::copymessage (Section 3.7) returns empty. Parameters:
       token channel

   mime::sendmessage (Section 3.8) returns empty. Parameters:
       token ?-server list?       ?-queue boolean?
             ?-atleastone boolean?
             ?-originator string? ?-recipients string?
             ?-header {key value}?...

   mime::parseaddress (Section 3.9) returns list of array. Parameters:
       string

   mime::parsedatetime (Section 3.10) returns string. Parameters:
       [string | -now] property












Rose                                                            [Page 4]
=0C
README                          MIME Tcl                       June 1999


3. SEMANTICS

3.1 mime::initialize

   mime::initialize creates a MIME part:=20

   o  If the -canonical option is present, then the body is in
      canonical (raw) form and is found by consulting either the -file,
      -string, or -part option.=20

      In addition, both the -param and -header options may occur zero
      or more times to specify "Content-Type" parameters (e.g.,
      "charset") and header keyword/values (e.g.,
      "Content-Disposition"), respectively.=20

      Also, -encoding, if present, specifies the
      "Content-Transfer-Encoding" when copying the body.

   o  If the -canonical option is not present, then the MIME part
      contained in either the -file or the -string option is parsed,
      dynamically generating subordinates as appropriate.

3.2 mime::finalize

   mime::finalize destroys a MIME part.

   If the -subordinates option is present, it specifies which
   subordinates should be also be destroyed. The default value is
   "dynamic".

3.3 mime::getproperty

   mime::getproperty returns the properties of a MIME part.

   There are four properties: "content", "encoding", "params", and
   "parts". The "parts" property is present only if the MIME part has
   subordinates.

   If mime::getproperty is invoked with the name of a specific
   property, then the corresponding value is returned; instead, if
   -names is specified, a list of all properties is returned;
   otherwise, a serialized array of properties and values is returned.

3.4 mime::getheader

   mime::getheader returns the header of a MIME part.

   A header consists of zero or more key/value pairs. Each value is a
   list containing one or more strings.

   If mime::getheader is invoked with the name of a specific key, then


Rose                                                            [Page 5]
=0C
README                          MIME Tcl                       June 1999


   the corresponding value is returned; instead, if -names is
   specified, a list of all keys is returned; otherwise, a serialized
   array of keys and values is returned.

3.5 mime::setheader

   mime::setheader writes, appends to, or deletes the value associated
   with a key in the header.

   The value for -mode is one of:=20

      write: the key/value is either created or overwritten (the
      default);

      append: a new value is appended for the key (creating it as
      necessary); or,

      delete: all values associated with the key are removed (the
      "value" parameter is ignored).

   Regardless, mime::setheader returns the previous value associated
   with the key.

3.6 mime::getbody

   mime::getbody returns the body of a leaf MIME part in canonical form.

   If the -callback option is present, then it is repeatedly invoked
   with a fragment of the body as this:

       uplevel #0 $callback [list "data" $fragment]

   (The -blocksize option, if present, specifies the maximum size of
   each fragment passed to the callback.)

   When the end of the body is reached, the callback is invoked as:

       uplevel #0 $callback "end"

   The return value of the callback is returned by mime::getbody.

   Alternatively, if an error occurs, the callback is invoked as:

       uplevel #0 $callback [list "error" reason]

   After the callback returns, the error is propagated back by
   mime::getbody.

   If the -callback option is absent, then the return value of


Rose                                                            [Page 6]
=0C
README                          MIME Tcl                       June 1999


   mime::getbody is a string containing the MIME part's entire body.

3.7 mime::copymessage

   mime::copymessage copies the MIME part to the specified channel.

   mime::copymessage operates synchronously, and uses vwait to allow
   asynchronous operations to proceed independently.

3.8 mime::sendmessage

   mime::sendmessage sends a MIME part to an SMTP server.

   The options are:=20

      -server: a list of SMTP servers (the default is "localhost");

      -queue: indicates that the SMTP server should queue the message
      for later processing;

      -atleastone: indicates that the SMTP server must find accept at
      least one recipient for the message to be sent;

      -originator: a string containing an 822-style address
      specification;

      -recipients: a string containing one or more 822-style address
      specifications; and,

      -header: a keyword/value pairing (may occur zero or more times).

   If the -originator option is not present, the originator address is
   taken from "From" (or "Resent-From"); similarly, if the -recipients
   option is not present, recipient addresses are taken from "To",
   "cc", and "Bcc" (or "Resent-To", and so on).

   mime::sendmessage adds headers as necessary to ensure that a valid
   822-style message is sent.













Rose                                                            [Page 7]
=0C
README                          MIME Tcl                       June 1999


3.9 mime::parseaddress

   mime::parseaddr takes a string containing one or more 822-style
   address specifications and returns a list of serialized arrays, one
   element for each address specified in the argument.

   Each serialized array contains these properties:

       property    value
       =3D=3D=3D=3D=3D=3D=3D=3D    =3D=3D=3D=3D=3D
       address     local@domain
       comment     822-style comment
       domain      the domain part (rhs)
       error       non-empty on a parse error
       group       this address begins a group
       friendly    user-friendly rendering
       local       the local part (lhs)
       memberP     this address belongs to a group
       phrase      the phrase part
       proper      822-style address specification
       route       822-style route specification (obsolete)

   Note that one or more of these properties may be empty.

3.10 mime::parsedatetime

   mime::parsedatetime takes a string containing an 822-style date-time
   specification and returns the specified property.

   The list of properties and their ranges are:

       property     range
       =3D=3D=3D=3D=3D=3D=3D=3D     =3D=3D=3D=3D=3D
       hour         0 .. 23
       lmonth       January, February, ..., December
       lweekday     Sunday, Monday, ... Saturday
       mday         1 .. 31
       min          0 .. 59
       mon          1 .. 12
       month        Jan, Feb, ..., Dec
       proper       822-style date-time specification
       rclock       elapsed seconds between then and now
       sec          0 .. 59
       wday         0 .. 6 (Sun .. Mon)
       weekday      Sun, Mon, ..., Sat
       yday         1 .. 366
       year         1900 ...
       zone         -720 .. 720 (minutes east of GMT)



Rose                                                            [Page 8]
=0C
README                          MIME Tcl                       June 1999


4. EXAMPLES

   package require mime 1.0


   # create an image

   set imageT [mime::initialize -canonical image/gif \
                                -file logo.gif]


   # parse a message

   set messageT [mime::initialize -file example.msg]


   # recursively traverse a message looking for primary recipients

   proc traverse {token} {
       set result ""

   # depth-first search
       if {![catch { mime::getproperty $token parts } parts]} {
           foreach part $parts {
   	    set result [concat $result [traverse $part]]
   	}
       }

   # one value for each line occuring in the header
       foreach value [mime::getheader $token To] {
           foreach addr [mime::parseaddress $value] {
   	    catch { unset aprops }
   	    array set aprops $addr
   	    lappend result $aprops(address)
   	}
       }

       return $result
   }


   # create a multipart containing both, and a timestamp

   set multiT [mime::initialize -canonical multipart/mixed
                                -parts [$imageT $messageT]]






Rose                                                            [Page 9]
=0C
README                          MIME Tcl                       June 1999


   # send it to some friends

   mime::sendmessage $multiT \
         -header From "Marshall Rose <mrose@dbc.mtview.ca.us>"
         -header To "Andreas Kupries <a.kupries@westend.com>"
         -header cc "dnew@messagemedia.com (Darren New)"
         -header Subject "test message..."


   # clean everything up

   mime::finalize $multiT -subordinates all







































Rose                                                           [Page 10]
=0C
README                          MIME Tcl                       June 1999


References

   [1]  Freed, N. and N.S. Borenstein, "Multipurpose Internet Mail
        Extensions (MIME) Part One: Format of Internet Message Bodies",
        RFC 2045, November 1996.

   [2]  Freed, N. and N.S. Borenstein, "Multipurpose Internet Mail
        Extensions (MIME) Part Two: Media Types", RFC 2046, November
        1995.

   [3]  Crocker, D., "Standard for the format of ARPA Internet Text
        Messages", RFC 822, STD 11, August 1982.

   [4]  http://www.scriptics.com/software/8.1.html

   [5]  http://www.oche.de/~akupries/soft/trf/

   [6]  mailto:dnew@messagemedia.com

   [7]  mailto:a.kupries@westend.com

Author's Address

   Marshall T. Rose
   Dover Beach Consulting, Inc.
   POB 960
   Denver, CO  80201-0960
   US

   Phone: +1 303 382 1260
   Fax:   +1 303 382 1264
   EMail: mrose@dbc.mtview.ca.us



















Rose                                                           [Page 11]
=0C
README                          MIME Tcl                       June 1999


Appendix A. Acknowledgements

   This package is influenced by the safe-tcl package (Borenstein and
   Rose, circa 1993), and also by Darren New[6]'s unpublished package
   of 1999.

   This package makes use of Andreas Kupries[7]'s excellent Trf package.












































Rose                                                           [Page 12]
=0C

------=_NextPart_000_0001_01BEC8A0.E96FE6A0--
