If you go on the Clovertech website and search for SMTP, you will find a post from John Harvey titled “working with email alerts” that gives you an example of the TCL proc you are looking for. I expanded on his proc slightly by adding a “From Address” parameter… see sendEmailMessage proc below.
proc sendEmailMessage {fromaddr recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -recipients $recipient -servers
-debug 1 -originator $fromaddr
mime::finalize $token
return
}
Here is the TCL proc that calls the sendEmailMessage proc. I call this from within my .bat file using the command “call tcl -c censusAlert”.
proc censusAlert {} {
sendEmailMessage “DoNotReply@abc.com” “jdoe@abc.com” “10.1.5.123” “Quovadx Census Alert!” “Interface for Census is down!”
sendEmailMessage “DoNotReply@abc.com” “kbrown@abc.com” “10.1.5.123” “Quovadx Census Alert!” “Interface for Census is down!”
}
You need to have tcllib installed in order to use the API to send email. You can find the download and instructions at
<a href="http://www.tcl.tk/software/tcllib/” class=”bbcode_url”>http://www.tcl.tk/software/tcllib/
It took me a little while to get all this installed and working but it’s a great tool now.