Email from Tcl

  • Creator
    Topic
  • #48197
    Barry Sheesley
    Participant

    I am trying to send an email from a Tcl proc whenever a certain condition exists.  I found what looks like a simple example but when I run it at my location, it hangs my Tcl proc for about 5 minutes or so and then throws an error.  The source I’m using to send the email is the following:

    proc sendEmailMessage {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

      mime::finalize $token

      return

      }

      This proc hangs on the smtp::sendmessage line and eventually throws the following error:

      Trying 10.1.5.123…

      <-- 220 masonsgw.masonichomespa.org GroupWise Internet Agent 6.5.4  Copyright (c) 1993-2005 Novell, Inc.  All rights reserved. Ready –> EHLO MH_INTERFACE (wait upto 300 seconds)

         … premature end-of-file from server …

      12/12/2005 10:56:06

      [pd  :pdtd:ERR /0:qs1_census_hl7] Tcl error:

      msgId = message0

      proc = ‘filterRxCensus’

      args = ”

      result = ‘masonsgw.masonichomespa.org GroupWise Internet Agent 6.5.4  Copyright (c) 1993-2005 Novell, Inc.  All rights reserved. Ready

      I know my IP address for the email server is correct.  I was able to find a standalone Tcl proc that will send an email successfully but I can’t get it to work through Quovadx.  Any help is greatly appreciated.

Viewing 2 reply threads
  • Author
    Replies
    • #57987
      John Harvey
      Participant

      Hi, I had issues with this proc for longest time.

      I’m using much the same proc as you are.  This proc takes the default user of the system and assumes it as an official e-mail address. With e-mail being as it is lately (spam, virus and whatever else can wreck a system), some systems won’t accept a message from whatever the default is.  

      You can override who the e-mail is from within the procedure, just add the highlighted code where you see it, or take this whole proc as is:

      proc send_mail_message {recipient email_server subject body} {

         package require smtp

         package require mime

         set from_address “your_email@whatever.bla

         set token [mime::initialize -canonical text/plain -string $body]

         mime::setheader $token Subject $subject

         smtp::sendmessage $token -recipients $recipient -servers $email_server -originator $from_address

         mime::finalize $token

      }

      I’m not sure this is your solution, but it’s worth trying I suppose.  Also, we had issues where the virus protection software on the server was preventing e-mail from even leaving the system.  Depending on what that is for you, that may also be something worth looking into…hope this helps!

      😀

    • #57988
      Barry Sheesley
      Participant

      John, thanks for your reply.  I tried your suggestion with adding the originator and now I get the following error back after about a 10 minute delay:

      [pd  :pdtd:ERR /0:qs1_census_hl7] Tcl error:

      msgId = message0

      proc = ‘filterRxCensus’

      args = ”

      result = ‘can’t read “response”: variable is array’

      errorInfo: ‘

      can’t read “response”: variable is array

      Anyone have any clues?

    • #57989
      Barry Sheesley
      Participant

      Success!  The -originator parameter you provided me did solve the problem I was having.  I was doing something else stupid in the Tcl proc that was giving me an error.  Thanks much for the assistance!

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10