Consider this code:
-----------------------------
# If no -originator was provided, get the
originator from the "From"
# header. If there was no "From" header get it
from the username
# executing the script.
set who "-originator"
if {$originator == ""} {
if {![info exists header($fromL)]} {
set originator $::tcl_platform(user)
} else {
set originator [join $header($fromL) ,]
# Indicate that we're using the From
header for the originator.
set who $fromM
}
}
# If there's no "From" header, create a From header
with the value
# of -originator as the value.
if {[lsearch -exact $lowerL $fromL] < 0} {
lappend lowerL $fromL
lappend mixedL $fromM
lappend header($fromL) $originator
}
# ::mime::parseaddress returns a list whose elements
are huge key-value
# lists with info about the addresses. In this case,
we only want one
# originator, so we want the length of the main list
to be 1.
set addrs [::mime::parseaddress $originator]
if {[llength $addrs] > 1} {
error "too many mailboxes in $who: $originator"
}
array set aprops [lindex $addrs 0]
if {$aprops(error) != ""} {
error "error in $who: $aprops(error)"
}
-----------------------------
It is entirely possible that there is no originator,
because tcl_platform(user) can be empty. In that case,
the above code will fail if no -originator is provided
because aprops(error) will be empty.
Logged In: YES
user_id=240
I think this is really a Tcl bug, but for the time being,
it's probably a good idea to provide a workaround here. The
Tcl bug in question is this: 681877