Email trigger in xlates…

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Email trigger in xlates…

  • Creator
    Topic
  • #53729
    Ronald Ortiz
    Participant

      Does anyone know of a way to trigger an email, from within the xlate when a condition has been met?

      For example:

      If ZCP segment missing

      —Email: Person@Business.com

         Subject: Missing ZCP

         Body: Message killed for Patient (Last, First), (MRN:__), (Visit:__)

    Viewing 2 reply threads
    • Author
      Replies
      • #78740
        bill bearden
        Participant

          We created a tclproc that we use both in other tclprocs and in embedded tcl within xlates. You don’t need a separate tclproc. You could just write the code as embedded tcl within the xlate.

          Not tested, but it goes something like this…

          Code:

          package require smtp
          package require mime
          set subject “Email from Cloverleaf”
          set body “This is the body”
          set to “Robert Robertson”
          set from “Cloverleaf”
          set recipient “rob@yahoo.com”
          set originator “cloverleaf@ourplace.com”
          set token [mime::initialize -canonical text/plain -string $body]
          mime::setheader $token Subject $subject
          mime::setheader $token To $to
          mime::setheader $token From $from
          smtp::sendmessage $token -recipients $recipient -servers youremailservername -originator $originator
          mime::finalize $token

        • #78741
          Ronald Ortiz
          Participant

            Hi Bill,

            Don’t suppose you have a working sample I can look at?

            Thanks,

            -Ron

            bill bearden wrote:

            We created a tclproc that we use both in other tclprocs and in embedded tcl within xlates. You don’t need a separate tclproc. You could just write the code as embedded tcl within the xlate.

            Not tested, but it goes something like this…

            Code:

            package require smtp
            package require mime
            set subject “Email from Cloverleaf”
            set body “This is the body”
            set to “Robert Robertson”
            set from “Cloverleaf”
            set recipient “rob@yahoo.com”
            set originator “cloverleaf@ourplace.com”
            set token [mime::initialize -canonical text/plain -string $body]
            mime::setheader $token Subject $subject
            mime::setheader $token To $to
            mime::setheader $token From $from
            smtp::sendmessage $token -recipients $recipient -servers youremailservername -originator $originator
            mime::finalize $token

          • #78742
            Ronald Ortiz
            Participant

              Ah!!!  

              This works GREAT!!!!

              Thanks Bill!!!

              Ronald Ortiz wrote:

              Hi Bill,

              Don’t suppose you have a working sample I can look at?

              Thanks,

              -Ron

              bill bearden wrote:

              We created a tclproc that we use both in other tclprocs and in embedded tcl within xlates. You don’t need a separate tclproc. You could just write the code as embedded tcl within the xlate.

              Not tested, but it goes something like this…

              Code:

              package require smtp
              package require mime
              set subject “Email from Cloverleaf”
              set body “This is the body”
              set to “Robert Robertson”
              set from “Cloverleaf”
              set recipient “rob@yahoo.com”
              set originator “cloverleaf@ourplace.com”
              set token [mime::initialize -canonical text/plain -string $body]
              mime::setheader $token Subject $subject
              mime::setheader $token To $to
              mime::setheader $token From $from
              smtp::sendmessage $token -recipients $recipient -servers youremailservername -originator $originator
              mime::finalize $token

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