I am trying to develop a procedure using tcltk that sends email from any windows or unix machine. I have written the below procedure and while it runs from Windows 2012 R2 server and also Debian it doesnot run from Windows 10 and it keeps showing the error --
530: 5.5.1 Authentication Required. key message-id not in header while executing "error "key $mixed not in header"" (procedure "::mime::getheader line 24) invoked from within "::mime::getheader $part ${message-idL} ........
The code I tried running is..
package require tls
package require smtp
package require mime
proc send_email {to subject body} {
set opts {}
lappend opts -servers "smtp.gmail.com"
lappend opts -ports 587
lappend opts -username "abcd@gmail.com"
lappend opts -password "pass"
lappend opts -header [list "Subject" $subject]
lappend opts -header [list "From" "abcd@gmail.com"]
lappend opts -header [list "To" $to]
set mime_msg [mime::initialize -canonical "text/plain" -encoding "7bit" -string $body]
smtp::sendmessage $mime_msg {*}$opts -usetls 1
mime::finalize $mime_msg
}
send_email "xyz@gmail.com" "test" "this is a test email"
Could anyone please help with this?