| Description: |
set mailHost localhost
set mailPort 25
set myAddress [email protected]
set addresses {
[email protected]
}
proc send_simple_message {recipient subject body} {
package require smtp
package require mime
global mailHost
global mailPort
global myAddress
set token [mime::initialize -canonical text/plain
-string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -recipients $recipient
-servers $mailHost\
-ports $mailPort -originator $myAddress
mime::finalize $token
}
for {set i 0} {$i < [llength $addresses]} {incr i} {
puts "Sending [expr {$i+1}]/[llength $addresses]"
send_simple_message [lindex $addresses $i] "Test: ne
pas répondre"\
"Ceci n'est qu'un test. Il n'est pas nécessaire de
répondre.\n\nL"
}
This is the error I get:
Sending 1/1
can't read "i": no such variable
(reading value of variable to increment)
invoked from within
"incr i"
("for" loop-end command)
invoked from within
"for {set i 0} {$i < [llength $addresses]} {incr i} {
puts "Sending [expr {$i+1}]/[llength $addresses]"
send_simple_message [lindex $addresses $i] "Te..."
(file "sendmail.tcl" line 27)
Now, if I change "i" to "ii", it works.
|