11-13-2013 08:41 AM
I am trying to send an email during an alarm state using the SMTP VIs included with LabVIEW (2013, have not tested 2012). It seems that the SMTP send VI hangs LabVIEW while it is running to the point that my software doesn't start shutting down because LabVIEW is waiting for SMTP send.
SMTP send is running parallel to everything else, so it shouldn't cause a hang just because it hasn't finished running. The UI stops redrawing (i.e. if I open a window in front of the program and close it, LabVIEW doesn't redraw the front panel - I still see the old window), every parallel process in the code stops running, and the cursor changes to the busy cursor while it works away.
Today at my office, this delay is 3-5 seconds. Last week when testing at my customer, the delay was 20-30 seconds. The email always gets sent, but it seems while it is logging into the mail server and doing whatever transactions are necessary, LabVIEW is non-responsive.
Please note I am sending a 1-2 sentence email with no attachments. I am not use SLL/TLS, although my server does require a username and password login.
Is anyone else seeign this?
Thanks,
Matthew
11-14-2013 04:48 PM
Hi Matthew_Kelton,
Can you post your code or a VI snippet?
Regards,
11-14-2013 04:57 PM
Joel,
I can't really do that here, as I would have to provide my login credentials to the email server. I could get it to happen with the express VI, too, but the SMTP Send is the actual sub VI that hangs LabVIEW. Even at 4-5 seconds to send the email, you'll notice you can't switch back and forth between windows in LabVIEW. With the express VI, you may be able to switch right when you start if you manage to get the window to switch before the send occurs.
Matthew
11-15-2013 05:37 PM
Hi Matthew_Kelton,
Have you tried running our shipping example?
Go to Help» Networking» Send Email using SMTP Client.vi
Let me know how that goes!
Regards,
11-15-2013 06:09 PM
For a data point: the example works fine for me. (I don't see Help -> Networking, so I searched in the example finder for SMTP.)
11-15-2013 06:57 PM
Joel,
Same behavior. As I noted in my original post, it locks up at send. If you have a fast connection to your server and are sending a short messsage, you may not see it. My server has a delay for loggin in and it is not internal, so it takes 5 seconds or so for it to login, and send the email. During that time, LabVIEW is non-responsive.
If you have a quick connection, you may need to try using the vi that sends attachments so the session with the server lasts longer.
The issue is specifically with vi.lib\smtpClient\Send.vi. It is password protected, so I cannot determine exactly what is locking up, but it is in there.
For now, I found an example on the forums that is not very robust, but got me through the immediate problem. It can send an email without locking up LabVIEW, so I know NI's code is doing something it probably shouldn't be.
Matthew
11-18-2013 06:46 PM
It sounds like it could be an issue with the network or that the native VIs have some additional overhead that you're not seeing the community examples that you mentioned.
Regards,
11-18-2013 07:14 PM
Joel,
My assumption is that there is either a loop running with no delay, or their making a blocking DLL call since LabVIEW won't do anything.
11-19-2013 05:41 PM
I'll look into this further, and let you know if I find anything, in the meantime, it seems as if the example you found online works for your application?
Regards,
11-19-2013 06:11 PM
Joel,
I have no choice but to deal with it. I would have prefered the NI VI since it appears to be more robust.
Matthew