smtp e-mail傳送
set opts {}
set sendlist {}
lappend opts -servers [list $server]
lappend opts -ports [list $serverport]
lappend opts -header [list "Subject" $subject]
lappend opts -header [list "From" $from]
lappend opts -header [list "To" $to]
set textT [mime::initialize -canonical text/plain -encoding "7bit" -string $body]
if { [llength $args] > 0 } {
set i 0
foreach {file} $args {
if { [file exists $file] } {
incr i
set "mailfile($i)" [mime::initialize -canonical "application/jpg; name=\"$file\"" -file $file]
lappend sendlist "$mailfile($i)"
}
}
}
set multiT [mime::initialize -canonical multipart/mixed -parts [linsert $sendlist 0 $textT]]
smtp::sendmessage $multiT {*}$opts -queue false -atleastone false -usetls false
mime::finalize $multiT
set sendlist {}
lappend opts -servers [list $server]
lappend opts -ports [list $serverport]
lappend opts -header [list "Subject" $subject]
lappend opts -header [list "From" $from]
lappend opts -header [list "To" $to]
set textT [mime::initialize -canonical text/plain -encoding "7bit" -string $body]
if { [llength $args] > 0 } {
set i 0
foreach {file} $args {
if { [file exists $file] } {
incr i
set "mailfile($i)" [mime::initialize -canonical "application/jpg; name=\"$file\"" -file $file]
lappend sendlist "$mailfile($i)"
}
}
}
set multiT [mime::initialize -canonical multipart/mixed -parts [linsert $sendlist 0 $textT]]
smtp::sendmessage $multiT {*}$opts -queue false -atleastone false -usetls false
mime::finalize $multiT
留言
張貼留言