smtp client question TCLLIB: 530: 5.7.0 Must issue a STARTTLS command first. 5sm81844eyf.18

Posted by djangoxl on 2009-06-16 09:11

Hi TCL guru's,

I'm trying to email from a tcl script I wrote, based on the example in http://docs.activestate.com/activetcl/8.4/tcllib/mime/smtp.html and amd getting a error.

Can anyone help me into getting my first tcl script to work?

The error I get is:

530: 5.7.0 Must issue a STARTTLS command first. 5sm81844eyf.18
while executing
"::smtp::sendmessage $token -recipients $recipient -servers $email_server -username $user -password $passwd"
(procedure "send_simple_message" line 11)
invoked from within
"send_simple_message someone@yahoo.com smtp.gmail.com "This is what I want the subject to be" "I care for you my sweat lady, I do.""
(file "sendjemail.tcl" line 14)

The script I'm using is:

proc send_simple_message {recipient email_server subject body} {
package require Tcl
package require smtp
package require mime

set token [mime::initialize -canonical text/plain -string $body]
set user "someone@gmail.com"
set passwd "somepassword"
set usetls true
mime::setheader $token Subject $subject
::smtp::sendmessage $token -recipients $recipient -servers $email_server -username $user -password $passwd
mime::finalize $token
}
send_simple_message someone@yahoo.com.com smtp.gmail.com "This is what I want the subject to be" "I care for you my sweat lady, I do."

It is happening on a AMD64 system running Freebsd 7.0 with tcllib-1.11.

Thanks in advanced.

ps don mind the message, it's to myself because I'm in love:-)