E-mail attachments constitute a surprisingly large and even unwieldy subject. The first clarification is to distinguish emission of e-mail with attachments, from its reception and interpretation. The Wiki page on the mime package focuses mostly on the latter.
The variety of ways to transmit e-mail attachments with Tcl is large. CL keeps a few models in [L1 ].
One of the reasons for active interest in the range of possibilities is typical for Tcl: one wants to compensate for various constraints. mime had severe flaws before tcllib 0.8 (and still has other errors--more on that, later) and is essentially unreliable with Tcl before 8.2. CL frequently needs to set up quick e-mail operations on hosts equipped with old interpreters; 7.6, for example, in the case of a client met in January 2002. For older interpreters, it's best to enlist outside help, as with
set tmpfile /tmp/abc[pid] set subject "This is the subject line." exec /usr/local/bin/mpack -s $subject -o $tmpfile $standard_name set To {The distribution list} set recipients "[email protected] [email protected] [email protected]" set recipients [join $recipients ,] exec $sendmail -t << \ "To: ($To) Bcc: $recipients [exec cat $tmpfile]"
Other useful external Unix utilities include pine, mutt, and uuencode [consider showing examples with all three].
Mutt:
THIS IS NOT CORRECT AS OF 20 Feb 2002. IN PROCESS OF CORRECTION.
set mailpipe [ open "| mutt -s \"$subject\" $attachment $to" w ] # set mailpipe [open "|mutt -s $subject $attachment $to" w], # I believe. fconfigure $mailpipe -buffering none puts $mailpipe $body close $mailpipe # Why not write simply # exec mutt -s $subject $attachment $to << $body # ?
FP: Another useful Unix utility for this job is UUDeview [L2 ]
uuenview -b -m [email protected] -s "The Subject" filename