# Send Email non-responsive UI thread detected

**URL:** <https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [March 8, 2022, 7:51pm UTC](https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978 "2022-03-08T19:51:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 8, 2022, 8:03pm UTC](https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978/3 "2022-03-08T20:03:08Z")

</div>

You are making a call to a gateway to send an email on your behalf, which is not bounded time-wise, from a Vision button. Vision button scripts, like all component events, runs in the java Swing foreground thread. Doing any long-duration (seconds) action on the foreground thread will block the user interface. In prior versions of Ignition, it could freeze indefinitely.

You need to learn to use `system.util.invokeAsynchronous()` to run your email send operation on a background thread, and report a notification back to your user at the end. Start here:

> [@Update GUI via Asynchronous thread](https://forum.inductiveautomation.com/t/update-gui-via-asynchronous-thread/9666):
>
> I’ve got a script I am experimenting with that can take a lot of time to execute, so I now use the system.util.invokeAsynchronous to run the script in a separate thread to keep the GUI from locking up. I am using the asynchronous thread to copy files from one place to another, and I would like to show the progress of the file copy with a progress bar. How would I go about this? I am importing a few python libraries to do this. import shutil def fileTransfer(): path = system.file.openFile() …

---

_[View the full topic](https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978)._
