How to create a delay between executing functions


Using the scripting tool, I am using the sgapiEmailSend function to send two emails.  I found that when I send the emails one right after the other, they don’t always end up in the recipients Inbox in the order I intended.  However, if I send them with a short delay (even five seconds), that works.

So I am looking for a way, within one script, to create a delay between using the sgapiEmailSend two separate times.  In PHP, there’s a sleep() function that does the trick but I don’t see an equivalent in SurveyGizmo scripting functions.

Any idea on what I can do to create a short delay between executing two functions within one script?

Thank you.  

Patrick McCabe answered

    Thanks for the quick reply.  I did try using the sleep() function but this “raw php” function didn’t work.  I did come up with a workaround but if you (or someone reading this) has another suggestion, I would be interested in your thoughts.

    Patrick McCabe answered
      IS 2.21K Rep.

      I haven’t tried sleep specifically yet, but most raw php has worked for me so far. I suggest giving it a try.

      IS answered


        Question stats

        • Active
        • Views6557 times
        • Answers2 answers
        • Followers1 follower