wanting example tcl proc for sending alert info to emails

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf wanting example tcl proc for sending alert info to emails

  • Creator
    Topic
  • #48739
    Nancy McDaniel
    Participant

      Does anyone having any sample tcl procedures that they have created to send alert info to emails? I have gotten my alerts to call .bat files but would like to get more information on the triggered alerts to send on the emails.

      thanks,

      Nancy

    Viewing 0 reply threads
    • Author
      Replies
      • #59539
        Barry Sheesley
        Participant

          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/&#8221; 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.

      Viewing 0 reply threads
      • The forum ‘Cloverleaf’ is closed to new topics and replies.