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?
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.
compressed size 199kb actial size 502 kb. It is also worth noting that the "email body" is a long formatted string.
I think the SMTP server is located in the same plant.
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.
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.)
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?
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.
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?