nsmail has useful code.
SS http://www.hping.org/tclsbignum/imap4.tcl has experimental pure Tcl client-side IMAP implementation. Please test it against your account and report bugs to antirez@invece.org.schlenk The imap code from SS was imported into tcllib cvs (modules/imap4), but isn't a proper tcllib module yet. If someone feels like writing docs, a testsuite or just patches to add the missing functionality, feel free to do so. (Be sure to get the above file from the tcllib repository: there have been changes.)Gerhard Reithofer 2010-06-30: After some investigation I found out that the module which I reworked is exactly that file above.
More information can be found in imap4, I'm currently discussing with AK about future of the module.
http://groups.google.com/groups?q=dianna+mullet+group%3Acomp.lang.tcl*&hl=en&selm=a4u64k%243si%242%40srv38.cas.org&rnum=1[ CL thinks he's seen code for a prototype client Tcl library. Where did it go? Scott Beasley?]Mark Roseman I may be mistaken, but I seem to recall a Tcl wrapper around the "c-client" library (part of UWashington's pine) that does IMAP. But this would have been years and years ago when I was working for a place doing a commercial IMAP client (back in 1994?) - EMJ (20-Mar-2008) this might perhaps have been http://www.island-resort.com/tcl-sift.htm .
Or were you looking for iMap: an indexed map viewer?
[Explain the new client tcllib provides as of summer 2004.]
RFox - 2012-07-17 12:21:48One source of docs: http://docs.activestate.com/activetcl/8.5/tcllib/imap4/imap4.html
HolgerJ Unfortunately, as of today (2016-01-15), the imap4 module of Tcllib doesn't support appending do a mailbox. My application is putting new draft messages into the 'Drafts' folder of an IMAP account.Appending a new message to a folder works by sending tag APPEND Entw&APw-rfe {[string length $mail]}\r\n to the open channel. If it's ok, the server will reply a string beginning with '+ '. Then send the mail content of length [string length $mail], the server will reply a string beginning with 'tag OK'. The 'tag' itself can by any short alphanumeric string and should be different for each command, like 'A001', 'A002' and so on.Sometimes, the 'Drafts' folder gets renamed to a folder with a local name like 'Entwürfe' in German, which is beyond the ASCII range. There is a solution for this described in section 5.1.3 of RFC 3501. This is a procedure converting a mailbox named to the needed format, which is called 'modified utf-7':
proc imapMailboxName {s} { set status ASCII set utf7String "" set retval "" foreach ch [split $s ""] { if {$ch < " " || $ch > "\u007f"} { ;# special handling for chars below 32 and above 127 switch -- $status { ASCII { ;# beginning a new utf7String set status UTF7 set utf7String "\u0000$ch" } UTF7 { append utf7String "\u0000$ch" ;# appending to an existing utf7String } } } else { if {$utf7String != ""} { ;# a utf7String has to be converted append retval "&[string trimright [binary encode base64 "$utf7String"] =]-" set status ASCII set utf7String "" } ;# if append retval $ch } } ;# foreach if {$utf7String != ""} { ;# a utf7String has to be converted append retval "&[string trimright [binary encode base64 "$utf7String"] =]-" set status ASCII set utf7String "" } ;# if return $retval } ;# proc imapMailboxNameIn order to create a mailbox, the returning string can be used. In Thunderbird, you can examine the real name of folders by right-clicking on one and look at the properties.