Announcement

Collapse
No announcement yet.

Does hs.SendMail() hang?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Does hs.SendMail() hang?

    I'm hoping someone knows an answer to this: I have a VB.NET script that makes a call to hs.SendMail(). Other things in the script don't seem to be working in a timely manner. Some debug statements I put in seem to indicate that about 10 seconds after I make the call to hs.SendMail() the script resumes right after that call. This is not on my system, so I don't have an easy way to check the mail setup.

    I would have thought that with the .NET and mutithreading that the call to hs.SendMail() would not block, especially since it doesn't actually return any indication of success or failure. Blocking for 10 seconds seems pretty extreme.

    Has anyone ever noticed this before? Is there an easy way to see what the delay is caused by?

    Steve

    #2
    I remember when email actions used to hang HS 1.7.

    The only thing I suggest is to put a hs.waitevent at the top of the script.

    WaitEvents

    Purpose

    This function will suspend operation of the script and allow the HomeSeer application to run. This is useful if you are waiting for a voice command or some other action that HomeSeer needs to recognize. If this function is not called, a script will time out in 30 seconds and prompt the user to either wait longer or kill the script. If this function is called within the 30 seconds, the script will not time out.


    ~Bill

    Comment


      #3
      Bill,

      Thanks for the reply. The thing is, I think the fact that hs.SendMail() seems to be blocking makes it so WaitEvents probably won't help. If I put the WaitEvents() before the call to SendMail, it will return and I'll make the call to SendMail and it will still hang. If I do it after the call to SendMail, it is after it hung.

      It seems to me like I should put in a ticket to HST to make SendMail() non-blocking.

      Steve

      Comment


        #4
        I just sense it is a network issue.
        I've used it for years in scripts and it has never caused an issue.


        ~Bill

        Comment


          #5
          Originally posted by Bill Brower View Post
          I just sense it is a network issue.
          I've used it for years in scripts and it has never caused an issue.
          I agree that it is something to do with the network or the mail setup that is the problem that SendMail() is hitting. My assertion is that an issue like that should calse SendMail() to fail to send the mail, but it shouldn't hang the script. It seems like there are two logical ways for it to work:

          hs.SendMail() returns right away, does not return a status, and HS (in a separate thread from the script) does whatever it does to try and send the mail. Success or failure, the script continues.

          OR

          hs.SendMail() does not return until it completes the attempt to send the mail, and returns a status indicating success or failure of the attempt.

          Right now it does a strange combination of both, and it doesn't make sense: It hangs and doesn't come back to the script until it has completed the try, but (by design) does NOT return any status to the script.

          Steve

          Comment


            #6
            Rick! HELP!


            ~Bill

            Comment


              #7
              Indeed! We need a "Rick: Read This" tag that we can apply to posts!

              Steve

              Comment


                #8
                Look at http://board.homeseer.com/showpost.p...&postcount=558 and http://board.homeseer.com/showpost.p...&postcount=559

                I wonder if HST have added a return parameter without announcing it?
                Jon

                Comment


                  #9
                  Originally posted by jon00 View Post
                  Look at http://board.homeseer.com/showpost.p...&postcount=558 and http://board.homeseer.com/showpost.p...&postcount=559

                  I wonder if HST have added a return parameter without announcing it?
                  Saddly, what I would prefer is that it NOT return anything, and not BLOCK. Maybe they need an overloaded version with some optional parameter that is ByRef so you could get a return status.

                  Steve

                  Comment


                    #10
                    Never mind!

                    Just FYI, I think I've discovered that the delay (or most of it) was something else in the user's configuration. So I guess I actually don't know if SendMail blocks or not, but for now I don't mind one way or the other.

                    Steve

                    Comment


                      #11
                      I use hs.sendemail quite a bit and have never seen it block. If it cannot make communication with the mail server, it justs provides an entry to the log and tries again up to 3 times.
                      Jon

                      Comment

                      Working...
                      X