Sending email from a thread problem

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Sending email from a thread problem

  • Creator
    Topic
  • #51181
    Sergey Sevastyanov
    Participant

      Hi all

      We are on CL 5.7 on Win 2003.

      I am having problems with sending emails with attachment (or without) from a UPoC thread. I have a Tcl proc that works just fine when called from hcitcl. When I use the same proc in UPoC thread (I tried both – using advanced scheduling and Read TPS) the email gets sent but it takes 25-40 minutes to send it.

      I don’t get any error messages. It just seems that responses from Exchange Server take forever. When I use debug mode in smtp::sendmessage I can see in the log that request sent to exchange server and then the proc just sits and waits for reply for long time. Then next request sends and again it takes forever to get reply.

      Here is the log:

      Quote:


      Trying EXSRV.MEEI.HARVARD.EDU…

      <-- 220 EXSRV.meei.harvard.edu Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at  Fri, 11 Sep 2009 17:32:19 -0400 –> EHLO interfacetest (wait upto 300 seconds)

      <-- 250-EXSRV.meei.harvard.edu Hello [10.100.10.23] <-- 250-TURN <-- 250-SIZE <-- 250-ETRN <-- 250-PIPELINING <-- 250-DSN <-- 250-ENHANCEDSTATUSCODES <-- 250-8bitmime <-- 250-BINARYMIME <-- 250-CHUNKING <-- 250-VRFY <-- 250-X-EXPS GSSAPI NTLM LOGIN <-- 250-X-EXPS=LOGIN <-- 250-AUTH GSSAPI NTLM LOGIN <-- 250-AUTH=LOGIN <-- 250-X-LINK2STATE <-- 250-XEXCH50 <-- 250 OK –> MAIL FROM:<Cloverleaf@meei.harvard.edu> SIZE=3028 (wait upto 600 seconds)

      <-- 250 2.1.0 Cloverleaf@meei.harvard.edu....Sender OK

      –> RCPT TO:<sergey_sevastyanov@meei.harvard.edu> (wait upto 3600 seconds)

      <-- 250 2.1.5 sergey_sevastyanov@meei.harvard.edu

      –> DATA (wait upto 300 seconds)

      <-- 354 Start mail input; end with .

      –> . (wait upto 120 seconds)

      in all places where log shows message like “(wait upto xxx seconds)” the process is actually waiting for several minutes.

      When I call my proc from hcitcl the messages in the log are the same but there is no wait time – I receive email immediately.

      So in one case the proc executed under my user id (hcitcl), and other case under hciuser (hciengine.exe). I don’t know if this can make any difference.

      Anyone has any ideas?

      Thanks

    Viewing 5 reply threads
    • Author
      Replies
      • #69075
        David Barr
        Participant

          I had the exact same problem with smtp::sendmessage.  We’re on Unix, and I modified my script to to call mime::buildmessage and send the results into a system call to /usr/sbin/sendmail.

        • #69076
          Sergey Sevastyanov
          Participant

            David,

            Thank you for your reply. I assume that sendmail in usr/sbin is a UNIX built-in feature?

            I am on Windows 2003, so this won’t work for me.

            Have you ever find out why this was happening? Is it exchange issue or something related to the way a thread works?

            Thanks

          • #69077
            Charlie Bursell
            Participant

              There is probably a vwait in the mail script and when the engine swaps it out, it gets lost.  That is why we say do not do anything that blocks in the engines.

              Try exec’ing it in the backgound from Tcl and see i that helps.

              If you need mail without attachments, try tclMail which, I believe, is out there somewhere on this board.

            • #69078
              Sergey Sevastyanov
              Participant

                Hi Charlie

                Do you mean I should use exec with & to call hcitcl from the thread?

                Thank you

              • #69079
                Charlie Bursell
                Participant

                  You cannot directly exec a Tcl or perl script from Tcl on Windows.  Windows only allows you exec .bat, .com, or .exe files

                  Exec Tcl (or hcitcl) and pass it the full path to the script, and arguments, with an & at the end.  Don’t forget that this is now not an engine script.  If you have a proc in the file it will have to be something like:

                  proc mymail {argv argc} {

                      …………….

                  }

                  mymail $argv $argc

                  Where argv is a list of command line arguments and argc, if needed, is the number or arguments

                • #69080
                  Sergey Sevastyanov
                  Participant

                    Hi Charlie

                    That worked!

                    Thank you very much for your help

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