Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/SMTP+with+attachments?V=29
QUERY_STRINGV=29
CONTENT_TYPE
DOCUMENT_URI/revision/SMTP+with+attachments
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.71.255.4
REMOTE_PORT56272
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.142.97.219
HTTP_CF_RAY88120d0668ab22f1-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_REFERERhttp://wiki.tcl.tk/revision/SMTP+with+attachments?V=29
HTTP_CF_CONNECTING_IP3.142.97.219
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {SMTP with attachments} \[SV\]\ (2003-10-14)\n\nResponse\ on\ request\ from\ \[LV\]\ on\ news:comp.lang.tcl\n\ \ \ *\ Subject:\ \[tcllib\]\ 1.0\ -\ \[mime\]\ encoding\ mail\ attachments\n\ \ \ *\ Date:\ 2003-10-13\n\ntested\ with\ 8.4.4\ on\ windows\ 98\n\ \ \ *\ SMTP\ server:\ 602Pro\ Lan\ Suite\n\ \ \ *\ email\ client:\ Outlook\ Express.\n\n\n======\n##\ made\ from\ example\ on\ ASPN\ by\ Jeff\ Hobbs\ and\ some\ code\ from\n##\ nstcl\ (AOLserver/OpenNSD-style\ routines\ for\ tclsh)\n##\ \ \ Copyright\ (c)\ 2000,\ 2001,\ 2002\ Michael\ A.\ Cleverly\n##\n##\ \ \ Sinisa\ Vujic,\ Datagram\ d.o.o.,\ 2003\n##\ script\ which\ sends\ self\ as\ attachment\n##\n##\ 8.4.3\ with\ trf2.1p1\ has\ problems\ when\ location\n##\ of\ Trf\ package\ isn't\ explicitly\ stated\ like\ this\n##\ set\ ::env(PATH)\ \$::env(PATH)\\\;H:/tcl/lib/trf\n##\ because\ Trf\ can't\ find\ crypt.dll\n\npackage\ require\ smtp\n\nnamespace\ eval\ dg_mail\ \{\n\ \ \ \ namespace\ export\ sendmail\n\n\ \ \ \ variable\ mailhost\ 127.0.0.1\n\ \ \ \ variable\ mailport\ 25\n\}\n\nproc\ dg_mail::sendmail\ \{to\ from\ subject\ body\ \{headers\ \"\"\}\ \{bcc\ \"\"\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{opt_attcs_type\ \"\"\}\ \{attcs_array_name\ \"\"\}\}\ \{\n\n\ \ \ \ if\ \{\[string\ length\ \$opt_attcs_type\]\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$opt_attcs_type\ !=\ \"-file\"\ &&\ \$opt_attcs_type\ !=\ \"-string\"\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"unknown\ option\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ if\ \{!\[string\ length\ \$attcs_array_name\]\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"unknown\ value\ for\ option\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ upvar\ 0\ \$attcs_array_name\ attcs_array\n\ \ \ \ \ \ \ \ set\ parts\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ foreach\ \{attc_name\ attc_options\}\ \[array\ get\ attcs_array\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ part\ \[eval\ ::mime::initialize\ \$attc_options\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ parts\ \$part\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \}\n\n\ \ \ \ variable\ mailhost\n\ \ \ \ variable\ mailport\n\n\ \ \ \ set\ command\ \[list\ ::smtp::sendmessage\ \$messageT\ -servers\ \$mailhost\ -ports\ \ \$mailport\]\n\n\ \ \ \ lappend\ command\ -header\ \[list\ From\ \$from\]\n\ \ \ \ lappend\ command\ -header\ \[list\ To\ \$to\]\n\ \ \ \ lappend\ command\ -header\ \[list\ Subject\ \$subject\]\n\n\ \ \ \ if\ \{\[string\ length\ \$bcc\]\}\ \{\n\ \ \ \ \ \ \ \ lappend\ command\ -header\ \[list\ Bcc\ \$bcc\]\n\ \ \ \ \}\n\n\ \ \ \ if\ \{\[string\ length\ \$headers\]\}\ \{\n\ \ \ \ \ \ \ \ foreach\ \{key\ value\}\ \$headers\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ command\ -header\ \[list\ \$key\ \$value\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n\ \ \ \ set\ err\ \[catch\ \{\ eval\ \$command\ \}\ result\]\n\ \ \ \ ::mime::finalize\ \$messageT\ -subordinates\ all\n\n\ \ \ \ if\ \{\$err\}\ \{error\ \$result\}\n\}\n\narray\ set\ attcs_options\ \{\}\nset\ attcs\ \[file\ join\ \[pwd\]\ \[info\ script\]\]\n\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=ascii\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ lappend\ opts\ -encoding\ quoted-printable\n\ \ \ \ lappend\ opts\ -header\ \{Content-Disposition\ attachment\}\n\ \ \ \ lappend\ opts\ -file\ \$attc\n\ \ \ \ set\ attcs_options(\$attc)\ \$opts\n\}\n\ndg_mail::sendmail\ [email protected]\ [email protected]\ \{Tcl\ smtp!\}\ Hello!\ \"\"\ \"\"\ \\\n\ \ \ \ -file\ \[namespace\ current\]::attcs_options\n======\n\n\[snichols\]\ I\ tested\ this\ script,\ and\ everything\ worked\ except\ for\ the\ file\ attachment\ part.\ \nFYI\ ...\ I\ did\ get\ the\ attachment\ add\ to\ work,\ but\ changed\ the\ last\ argument\ to\ a\ filename\ not\ Tcl\ array,\ \nand\ changed\ the\ following\ code\ in\ the\ main\ email\ proc\ above:\n\n======\n\ \ \ \ \ \ \ \ \ if\ \{\[string\ length\ \$opt_attcs_type\]\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ log\ \"Type:\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ log\ \"Processing:\ \$file\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ parts\ \[mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ imageT\ \[mime::initialize\ -canonical\ \"image/tif\;\ name=\\\"\[file\ tail\ \$file\]\\\"\"\ -file\ \$file\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ parts\ \$imageT\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\n\ \ \ \ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ \ \}\n======\n\nBasically,\ I\ can\ get\ away\ with\ this,\ because\ I\ am\ only\ adding\ one\ attachment\ per\ email\ \nand\ it\ will\ always\ be\ of\ the\ type\ tif.\n\n----\n\[SV\]\ (2005-03-13)\nSomewhere\ between\ revisions\ this\ line\ become\ invalid\n======\n\ \ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n======\nNow\ I\ changed\ it\ back\ to:\n======\n\ \ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=ascii\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n======\nOf\ course\ one\ must\ vary\ with\ 'canonical',\ 'encoding'\ and\ optionaly\ 'charset'\ in\ regard\ to\ mime\ type\ of\ attachments.\ \nHope\ it\ helps.\n\n----\n\n\[snichols\]\ Thanks\ \[SV\].\ Yes,\ your\ explanation\ helps.\ I\ got\ it\ working,\ anyway,\ but\ it's\ nice\ to\ see\ there\ really\ was\ an\ issue\ with\ the\ code,\ and\ others\ will\ not\ have\ to\ troubleshoot\ this\ again.\ :)\n\n\[snichols\]\ April\ 3rd,\ 2006.\ I\ really\ like\ your\ coding\ example\ of\ using\ the\ SMTP\ package\ with\ attachments.\ So,\ I'm\ sharing\ with\ others\ my\ code\ used\ in\ getting\ PDF\ file\ attachments\ to\ work\ with\ your\ sendmail\ proc.\ Notice\ the\ base64\ encoding\ and\ change\ in\ canonical\ in\ this\ snipit\ of\ code:\n\n======\n#\ Example\ of\ how\ to\ use\ sendmail\ proc\ with\ PDF\ file\ types.\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ \ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"application/pdf\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ \ \ \ \ lappend\ opts\ -encoding\ base64\n\ \ \ \ \ \ \ \ lappend\ opts\ -header\ \{Content-Disposition\ attachment\}\n\ \ \ \ \ \ \ \ lappend\ opts\ -file\ \$attc\n\ \ \ \ \ \ \ \ log\ \"Adding\ \$opts\ to\ attachment\ array.\"\n\ \ \ \ \ \ \ \ set\ attcs_options(\$attc)\ \$opts\n\}\n#\ Note:\ without\ the\ base64\ encoding\ of\ the\ attachment\ I\ got\ errors\ when\ opening\ the\ attachment\ sent\ via\ email.\n======\n\[Bezoar\]\ 5/14/2014\ \ -\ for\ a\ general\ catchall\ mime\ type\ that\ will\ send\ all\ types\ of\ files\ use\ application/octet-stream\n======\n#\ Example\ of\ how\ to\ use\ sendmail\ proc\ with\ All\ file\ types\ use\ this\ minor\ change\ to\ the\ above\ code\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ \ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"application/octet-stream\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ \ \ \ \ ....\n======\nI\ mailed\ an\ 4\ MB\ mp3\ and\ a\ 1.5M\ jpeg\ with\ this\ same\ mime\ type\ -cannonical\ option.\ \ \n\n----\n\n\[Kroc\]\ 12/3/2015\ -\ a\ quick\ example\ to\ send\ a\ PDF:\n\n======\nset\ parts\ \[mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\nlappend\ parts\ \[mime::initialize\ -canonical\ \"application/pdf\;\ name=\\\"\[file\ tail\ \$pdfname\]\\\"\"\ -encoding\ base64\\\n\ \ \ \ \ \ \ \ -header\ \{Content-Disposition\ attachment\}\ -file\ \$pdfname\]\nset\ token\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\nset\ command\ \[list\ ::smtp::sendmessage\ \$token\\\n\ \ \ \ \ \ \ \ -servers\ \$mailhost\ -ports\ \$mailport\ -username\ \$mailuser\ -password\ \$mailpass\ -usetls\ 1\\\n\ \ \ \ \ \ \ \ -header\ \[list\ From\ \"\$mailfrom\"\]\ -header\ \[list\ To\ \"\$mailto\"\]\ -header\ \[list\ Subject\ \"\$subject\"\]\\\n\ \ \ \ \ \ \ \ -header\ \[list\ Date\ \"\[clock\ format\ \[clock\ seconds\]\]\"\]\]\nif\ \{\[catch\ \{eval\ \$command\}\ err\]\}\ \{\n\ \ \ \ \ \ \ \ error\ \"Error\ when\ sending\ mail:\ \$err\"\n\}\ncatch\ \{::mime::finalize\ \$token\ -subordinates\ all\}\n======\n\nEE\ 2015-12-08\ I\ don't\ think\ this\ is\ right.\ In\ fact,\ I'm\ almost\ entirely\ certain\ that\ passing\ an\ `eval`\ to\ the\ `catch`\ command\ is\ altogether\ wrong.\ Why\ not\ use\ `\[catch\ \$command\ err\]`\ instead?\n\nSee\ also:\ \[SMTP\]\n======\n\nFor\ a\ useful,\ detailed\ description\ of\ Tcl's\ handling\ of\ email,\ including\ attachments,\ see\ https://www.packtpub.com/books/content/tcl-handling-email\n\n<<categories>>\ Networking regexp2} CALL {my render {SMTP with attachments} \[SV\]\ (2003-10-14)\n\nResponse\ on\ request\ from\ \[LV\]\ on\ news:comp.lang.tcl\n\ \ \ *\ Subject:\ \[tcllib\]\ 1.0\ -\ \[mime\]\ encoding\ mail\ attachments\n\ \ \ *\ Date:\ 2003-10-13\n\ntested\ with\ 8.4.4\ on\ windows\ 98\n\ \ \ *\ SMTP\ server:\ 602Pro\ Lan\ Suite\n\ \ \ *\ email\ client:\ Outlook\ Express.\n\n\n======\n##\ made\ from\ example\ on\ ASPN\ by\ Jeff\ Hobbs\ and\ some\ code\ from\n##\ nstcl\ (AOLserver/OpenNSD-style\ routines\ for\ tclsh)\n##\ \ \ Copyright\ (c)\ 2000,\ 2001,\ 2002\ Michael\ A.\ Cleverly\n##\n##\ \ \ Sinisa\ Vujic,\ Datagram\ d.o.o.,\ 2003\n##\ script\ which\ sends\ self\ as\ attachment\n##\n##\ 8.4.3\ with\ trf2.1p1\ has\ problems\ when\ location\n##\ of\ Trf\ package\ isn't\ explicitly\ stated\ like\ this\n##\ set\ ::env(PATH)\ \$::env(PATH)\\\;H:/tcl/lib/trf\n##\ because\ Trf\ can't\ find\ crypt.dll\n\npackage\ require\ smtp\n\nnamespace\ eval\ dg_mail\ \{\n\ \ \ \ namespace\ export\ sendmail\n\n\ \ \ \ variable\ mailhost\ 127.0.0.1\n\ \ \ \ variable\ mailport\ 25\n\}\n\nproc\ dg_mail::sendmail\ \{to\ from\ subject\ body\ \{headers\ \"\"\}\ \{bcc\ \"\"\}\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{opt_attcs_type\ \"\"\}\ \{attcs_array_name\ \"\"\}\}\ \{\n\n\ \ \ \ if\ \{\[string\ length\ \$opt_attcs_type\]\}\ \{\n\ \ \ \ \ \ \ \ if\ \{\$opt_attcs_type\ !=\ \"-file\"\ &&\ \$opt_attcs_type\ !=\ \"-string\"\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"unknown\ option\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ if\ \{!\[string\ length\ \$attcs_array_name\]\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ error\ \"unknown\ value\ for\ option\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ upvar\ 0\ \$attcs_array_name\ attcs_array\n\ \ \ \ \ \ \ \ set\ parts\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ foreach\ \{attc_name\ attc_options\}\ \[array\ get\ attcs_array\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ set\ part\ \[eval\ ::mime::initialize\ \$attc_options\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ parts\ \$part\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \}\n\n\ \ \ \ variable\ mailhost\n\ \ \ \ variable\ mailport\n\n\ \ \ \ set\ command\ \[list\ ::smtp::sendmessage\ \$messageT\ -servers\ \$mailhost\ -ports\ \ \$mailport\]\n\n\ \ \ \ lappend\ command\ -header\ \[list\ From\ \$from\]\n\ \ \ \ lappend\ command\ -header\ \[list\ To\ \$to\]\n\ \ \ \ lappend\ command\ -header\ \[list\ Subject\ \$subject\]\n\n\ \ \ \ if\ \{\[string\ length\ \$bcc\]\}\ \{\n\ \ \ \ \ \ \ \ lappend\ command\ -header\ \[list\ Bcc\ \$bcc\]\n\ \ \ \ \}\n\n\ \ \ \ if\ \{\[string\ length\ \$headers\]\}\ \{\n\ \ \ \ \ \ \ \ foreach\ \{key\ value\}\ \$headers\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ command\ -header\ \[list\ \$key\ \$value\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n\ \ \ \ set\ err\ \[catch\ \{\ eval\ \$command\ \}\ result\]\n\ \ \ \ ::mime::finalize\ \$messageT\ -subordinates\ all\n\n\ \ \ \ if\ \{\$err\}\ \{error\ \$result\}\n\}\n\narray\ set\ attcs_options\ \{\}\nset\ attcs\ \[file\ join\ \[pwd\]\ \[info\ script\]\]\n\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=ascii\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ lappend\ opts\ -encoding\ quoted-printable\n\ \ \ \ lappend\ opts\ -header\ \{Content-Disposition\ attachment\}\n\ \ \ \ lappend\ opts\ -file\ \$attc\n\ \ \ \ set\ attcs_options(\$attc)\ \$opts\n\}\n\ndg_mail::sendmail\ [email protected]\ [email protected]\ \{Tcl\ smtp!\}\ Hello!\ \"\"\ \"\"\ \\\n\ \ \ \ -file\ \[namespace\ current\]::attcs_options\n======\n\n\[snichols\]\ I\ tested\ this\ script,\ and\ everything\ worked\ except\ for\ the\ file\ attachment\ part.\ \nFYI\ ...\ I\ did\ get\ the\ attachment\ add\ to\ work,\ but\ changed\ the\ last\ argument\ to\ a\ filename\ not\ Tcl\ array,\ \nand\ changed\ the\ following\ code\ in\ the\ main\ email\ proc\ above:\n\n======\n\ \ \ \ \ \ \ \ \ if\ \{\[string\ length\ \$opt_attcs_type\]\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ log\ \"Type:\ \$opt_attcs_type\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ log\ \"Processing:\ \$file\"\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ parts\ \[mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ imageT\ \[mime::initialize\ -canonical\ \"image/tif\;\ name=\\\"\[file\ tail\ \$file\]\\\"\"\ -file\ \$file\]\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ lappend\ parts\ \$imageT\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\n\ \ \ \ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ set\ messageT\ \[::mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\n\ \ \ \ \ \ \ \ \ \}\n======\n\nBasically,\ I\ can\ get\ away\ with\ this,\ because\ I\ am\ only\ adding\ one\ attachment\ per\ email\ \nand\ it\ will\ always\ be\ of\ the\ type\ tif.\n\n----\n\[SV\]\ (2005-03-13)\nSomewhere\ between\ revisions\ this\ line\ become\ invalid\n======\n\ \ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n======\nNow\ I\ changed\ it\ back\ to:\n======\n\ \ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"text/plain\;\ charset=ascii\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n======\nOf\ course\ one\ must\ vary\ with\ 'canonical',\ 'encoding'\ and\ optionaly\ 'charset'\ in\ regard\ to\ mime\ type\ of\ attachments.\ \nHope\ it\ helps.\n\n----\n\n\[snichols\]\ Thanks\ \[SV\].\ Yes,\ your\ explanation\ helps.\ I\ got\ it\ working,\ anyway,\ but\ it's\ nice\ to\ see\ there\ really\ was\ an\ issue\ with\ the\ code,\ and\ others\ will\ not\ have\ to\ troubleshoot\ this\ again.\ :)\n\n\[snichols\]\ April\ 3rd,\ 2006.\ I\ really\ like\ your\ coding\ example\ of\ using\ the\ SMTP\ package\ with\ attachments.\ So,\ I'm\ sharing\ with\ others\ my\ code\ used\ in\ getting\ PDF\ file\ attachments\ to\ work\ with\ your\ sendmail\ proc.\ Notice\ the\ base64\ encoding\ and\ change\ in\ canonical\ in\ this\ snipit\ of\ code:\n\n======\n#\ Example\ of\ how\ to\ use\ sendmail\ proc\ with\ PDF\ file\ types.\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ \ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"application/pdf\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ \ \ \ \ lappend\ opts\ -encoding\ base64\n\ \ \ \ \ \ \ \ lappend\ opts\ -header\ \{Content-Disposition\ attachment\}\n\ \ \ \ \ \ \ \ lappend\ opts\ -file\ \$attc\n\ \ \ \ \ \ \ \ log\ \"Adding\ \$opts\ to\ attachment\ array.\"\n\ \ \ \ \ \ \ \ set\ attcs_options(\$attc)\ \$opts\n\}\n#\ Note:\ without\ the\ base64\ encoding\ of\ the\ attachment\ I\ got\ errors\ when\ opening\ the\ attachment\ sent\ via\ email.\n======\n\[Bezoar\]\ 5/14/2014\ \ -\ for\ a\ general\ catchall\ mime\ type\ that\ will\ send\ all\ types\ of\ files\ use\ application/octet-stream\n======\n#\ Example\ of\ how\ to\ use\ sendmail\ proc\ with\ All\ file\ types\ use\ this\ minor\ change\ to\ the\ above\ code\nforeach\ attc\ \$attcs\ \{\n\ \ \ \ \ \ \ \ ##\ charset\ is\ optional\n\ \ \ \ \ \ \ \ set\ opts\ \[list\ -canonical\ \"application/octet-stream\;\ name=\\\"\[file\ tail\ \$attc\]\\\"\"\]\n\ \ \ \ \ \ \ \ ....\n======\nI\ mailed\ an\ 4\ MB\ mp3\ and\ a\ 1.5M\ jpeg\ with\ this\ same\ mime\ type\ -cannonical\ option.\ \ \n\n----\n\n\[Kroc\]\ 12/3/2015\ -\ a\ quick\ example\ to\ send\ a\ PDF:\n\n======\nset\ parts\ \[mime::initialize\ -canonical\ text/plain\ -string\ \$body\]\nlappend\ parts\ \[mime::initialize\ -canonical\ \"application/pdf\;\ name=\\\"\[file\ tail\ \$pdfname\]\\\"\"\ -encoding\ base64\\\n\ \ \ \ \ \ \ \ -header\ \{Content-Disposition\ attachment\}\ -file\ \$pdfname\]\nset\ token\ \[::mime::initialize\ -canonical\ multipart/mixed\ -parts\ \$parts\]\nset\ command\ \[list\ ::smtp::sendmessage\ \$token\\\n\ \ \ \ \ \ \ \ -servers\ \$mailhost\ -ports\ \$mailport\ -username\ \$mailuser\ -password\ \$mailpass\ -usetls\ 1\\\n\ \ \ \ \ \ \ \ -header\ \[list\ From\ \"\$mailfrom\"\]\ -header\ \[list\ To\ \"\$mailto\"\]\ -header\ \[list\ Subject\ \"\$subject\"\]\\\n\ \ \ \ \ \ \ \ -header\ \[list\ Date\ \"\[clock\ format\ \[clock\ seconds\]\]\"\]\]\nif\ \{\[catch\ \{eval\ \$command\}\ err\]\}\ \{\n\ \ \ \ \ \ \ \ error\ \"Error\ when\ sending\ mail:\ \$err\"\n\}\ncatch\ \{::mime::finalize\ \$token\ -subordinates\ all\}\n======\n\nEE\ 2015-12-08\ I\ don't\ think\ this\ is\ right.\ In\ fact,\ I'm\ almost\ entirely\ certain\ that\ passing\ an\ `eval`\ to\ the\ `catch`\ command\ is\ altogether\ wrong.\ Why\ not\ use\ `\[catch\ \$command\ err\]`\ instead?\n\nSee\ also:\ \[SMTP\]\n======\n\nFor\ a\ useful,\ detailed\ description\ of\ Tcl's\ handling\ of\ email,\ including\ attachments,\ see\ https://www.packtpub.com/books/content/tcl-handling-email\n\n<<categories>>\ Networking} CALL {my revision {SMTP with attachments}} CALL {::oo::Obj279624 process revision/SMTP+with+attachments} CALL {::oo::Obj279622 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4