# 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:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mandeep\_gill](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mandeep\_gill](https://forum.inductiveautomation.com/u/mandeep_gill)\
**Post date:** [March 8, 2022, 7:51pm UTC](https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978/1 "2022-03-08T19:51:26Z")

</div>

Hi Team,  
i come accross issue with Send email. I am currently have ignition vision 8.1.14 running on windows server 2019.  
I am trigging the button action from designer which send the email to me. Currently each time i am pressing the button. It freeze the designer for 5-10seconds and then shows error on output console:

Error on Output Console:  
[EDT-Watchdog-1] INFO edt-watchdog - Non-responsive UI thread detected. Stack saved at 'C:\Users\mg.ignition\cache\gwlocalhost\_8088\C0\NonResponsiveEdt-2022-03-09\_083926.json'

Code on button action:

# This code sends an HTML-formatted email to multiple recipients, including a cc, with no attachments,

# using an smtp server defined in the Gateway.

subject = "data"  
sender = "email@xx.co.nz"  
body = "

# This is a big header
"  
body += "And this text is red"  
recipients = ["Myemail@xx.co.nz"]  
cc\_recipients = ["Myemail@xx.co.nz"]  
smtp\_server = "EmailNotificationProfilename"  
system.net.sendEmail(smtpProfile=smtp\_server, fromAddr=sender, subject=subject, body=body, html=1, to=recipients, cc=cc\_recipients)

i will attached the file with this topic.

---

<div class="post-metadata">

**Author:** ![mandeep\_gill](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mandeep\_gill](https://forum.inductiveautomation.com/u/mandeep_gill)\
**Post date:** [March 8, 2022, 7:52pm UTC](https://forum.inductiveautomation.com/t/send-email-non-responsive-ui-thread-detected/56978/2 "2022-03-08T19:52:21Z")

</div>

[NonResponsiveEdt-2022-03-09\_083926.json](https://forum.inductiveautomation.com/uploads/short-url/yEX0tiVuE1SEDXl2cmsInoDMWal.json) (64.7 KB)

---

<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() …
