# Email Script with Attachment slow

**URL:** <https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026>\
**Category:** Ignition\
**Created:** [October 26, 2023, 12:36pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026 "2023-10-26T12:36:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Perelmutter](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeff\_Perelmutter](https://forum.inductiveautomation.com/u/Jeff_Perelmutter)\
**Post date:** [October 26, 2023, 12:36pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/1 "2023-10-26T12:36:28Z")

</div>

I want to send an email with a .zip attachment when a button is pressed, it works but it takes 20-45 seconds to execute. Is there any way to speed up sending an email?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/0/40d7283fed5fc75851bebe4da03e0c060d5c121f.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 26, 2023, 12:39pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/2 "2023-10-26T12:39:30Z")

</div>

How large is the file? Where is the SMTP server located relative to the client that is uploading the file? You're probably just stuck waiting for the attachment data to upload.

---

<div class="post-metadata">

**Author:** ![Jeff\_Perelmutter](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeff\_Perelmutter](https://forum.inductiveautomation.com/u/Jeff_Perelmutter)\
**Post date:** [October 26, 2023, 12:44pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/3 "2023-10-26T12:44:53Z")

</div>

compressed size 199kb actial size 502 kb. It is also worth noting that the "email body" is a long formatted string.

---

<div class="post-metadata">

**Author:** ![Jeff\_Perelmutter](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeff\_Perelmutter](https://forum.inductiveautomation.com/u/Jeff_Perelmutter)\
**Post date:** [October 26, 2023, 12:46pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/4 "2023-10-26T12:46:21Z")

</div>

I think the SMTP server is located in the same plant.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 26, 2023, 12:55pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/5 "2023-10-26T12:55:34Z")

</div>

Well... it's not like there's anything you can do on the Ignition side to speed it up. You're not missing some secret parameter that makes it faster. It's a function of the network connection and the SMTP server.

You might consider sending this email in the background so it doesn't freeze up the UI if you're not already doing that.

Maybe a Wireshark capture and working with your IT department will help figure out why it's so slow.

---

<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:** [October 26, 2023, 12:59pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/6 "2023-10-26T12:59:34Z")

</div>

It is not unusual for mail servers to delay reception while trying to reverse DNS the sender. (A best practice, IMNSHO.) That might need to be short-circuited for your gateway(s), or for authenticated senders on the submission port. (You are authenticating on the submission port, I hope. If not, your SMTP server is an _ **open relay** _. That is very bad.)

---

<div class="post-metadata">

**Author:** ![Jeff\_Perelmutter](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeff\_Perelmutter](https://forum.inductiveautomation.com/u/Jeff_Perelmutter)\
**Post date:** [October 26, 2023, 1:10pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/7 "2023-10-26T13:10:27Z")

</div>

I guess my main concern is if multiple users click the button, will there be emails that are not sent? Can I remedy this by adding multiple retry attempts? Another question, could I attach link instead of a zipped file to increase speed?

---

<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:** [October 26, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/8 "2023-10-26T13:49:46Z")

</div>

If it is rDNS, there's no help for it at the Ignition side. The mail server will simply time out on rDNS before proceeding.

---

<div class="post-metadata">

**Author:** ![Jeff\_Perelmutter](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@Jeff\_Perelmutter](https://forum.inductiveautomation.com/u/Jeff_Perelmutter)\
**Post date:** [October 26, 2023, 2:58pm UTC](https://forum.inductiveautomation.com/t/email-script-with-attachment-slow/81026/9 "2023-10-26T14:58:55Z")

</div>

I think I may have solved my problem, if i copy a file link i can store it in a database as a string and open it using system.net.openURL(string). Is there a script that lets you copy a one drive link or will i need the user to do this mannually?
