# test_examples.txt -- # $Id: test_examples.txt,v 1.1 2000/02/13 18:43:00 dhagberg Exp $ # # Some sample commands that can be copied/pasted into a Tcl console # for testing. Provides some reasonable examples of the features # that people might want to use. package require ezsmtp ezsmtp::config -mailhost cayenne -from dhagberg@millibits.com -verbose 9 # Return the current time, formatted ISO-8601, in GMT. proc t {} { clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S} -gmt 1 } # Test simple send, taking body from a variable, setting reply address # to one different than `From:', to a list of recipients. set body "Body of test 1 at time [t]" ezsmtp::send -replyto dhagberg@glatmos.com \ -tolist [list d.j.hagberg@acm.org dhagberg@millibits.com] \ -subject "Test 1 [t]" -body $body # Test list options, batching of addresses, and return-receipt ezsmtp::send -from "D. J. Hagberg ACM " \ -tolist [list "D. J. Hagberg WRK "] \ -cclist [list "D. J. Hagberg ACM "] \ -bcclist [list "D. J. Hagberg MBT "] \ -subject "Test 2 [t]" -body "Body of test 2\nat time [t]" \ -receipt [list delivery 1 delay 0 envelopeid "CLK=[clock seconds]"] \ -batchsize 2 # Test deprecated addressing -- should throw an error with ezsmtp >= 1.0 ezsmtp::send -from "D. J. Hagberg MBT " \ -subject "Test 3 [t]" -body "Body of test 3\nat time [t]" \ -receipt 0 -batchsize 2 \ dhagberg@glatmos.com "D. J. Hagberg ACM " \ dhagberg@millibits.com # Test customized -headers output ezsmtp::send -to dhagberg -headers [list Subject "A subject line" \ Date [clock format [clock seconds]] \ From "Laurent Duperval "]\ -body {Text body} # Test handling of non-ASCII (russian) character set reading from a file. set k8r [open koi8-r-body.txt r] fconfigure $k8r -encoding koi8-r ezsmtp::send -from dhagberg@glatmos.com \ -to dhagberg@millibits.com \ -subject "test 1 [t]" \ -channel $k8r \ -charset koi8-r close $k8r