Posted to tcl by nscerqueira at Thu May 19 14:16:38 GMT 2016view pretty
package require mime package require smtp package require tls # tls::init -tls1 true -ssl2 false -ssl3 false proc send_email {from to subject body} { set opts {} lappend opts -servers smtp.gmail.com lappend opts -ports [list 587] lappend opts -debug 1 lappend opts -username user lappend opts -password xxxxx lappend opts -header [list "Subject" $subject] lappend opts -header [list "From" $from] lappend opts -header [list "To" $to] set mime_msg [mime::initialize -canonical "text/plain" -encoding "7bit" -string $body] smtp::sendmessage $mime_msg {*}$opts -queue false -atleastone false -usetls false mime::finalize $mime_msg } puts "in" send_email "Twylite <xxxxx@gmail.com>" "Person <xxxx@gmail.com>" \ "Test" { This is my mail message. } puts "out"