# SendMail in Dynamic Refresh executed continuously in a loop. UpdateInterval and TrackedSymbols ignored! [closed]

I am writing a program that simulates water storage with combined rain and pump fed supply. To allow a hypothetic employee in control to overview the situation while inspecting some remote locations of the park an email needs to be sent every five minutes with latest figures and a chart.

I use the following code to achieve the results close to described above. The "chart" and "legend" are both bitmaps, please replace them with "test","test" if you want to test it.

And now the issue that left me speechless and desperate at the same time: The email is sent. It is perfectly composed and with nicely rendered and not distorted bitmaps. However it is sent up to three times a second!

I've rewritten the code several times from scratch replacing SendMail with something else and returning SendMail back into the module. It appears that SendMail causes the Refresh function to fire continuously ignoring completely the UpdateInterval and TrackedSymbols options altogether.

I have an uncertain feeling that I did something wrong and the code is incomplete to do what I want. What could it be?

Dynamic[
Refresh[
SendMail["To" -> "xyz@gmail.com",
"Subject" -> "Pump Storage BX, Inflow Progress", "Body" -> {chart, legend},
"From" -> "xyz@gmail.com", "Server" -> "smtp.gmail.com",

 The problem might be that your syntax for tracked symbols is incorrect. Specifically, you forgot Rule in the option. – rm -rf♦ Mar 16 at 15:20 UpdateInterval is an upper bound in any case – Rojo Mar 16 at 15:21 I don't see why tracked symbols incorrect. In the code was -> missing. My code in Mathematica had TrackedSymbols->{}. I've just added it to the fragment above to prevent further confusion. Where and how do I use Rule? The documentation is short on hints. – user6415 Mar 16 at 16:15 That's exactly what I meant... that you're missing -> (which is Rule). This means that Mathematica does not know about which symbols should be tracked (in essence, the typo is as good as not specifying it) – rm -rf♦ Mar 16 at 16:18 Rojo, does your comment mean, that UpdateInterval -> 300 will make the code execute every 300 seconds or more frequently? If I put e.g. DateString[] the code in my case executes every five minutes as expected. – user6415 Mar 16 at 16:19