LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug? SMTP send hangs LabVIEW

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

 

0 Kudos
Message 1 of 17
(3,887 Views)

Hi Matthew_Kelton,

 

Can you post your code or a VI snippet?

 

Regards,

Joel I.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 17
(3,844 Views)

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

 

0 Kudos
Message 3 of 17
(3,840 Views)

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,

Joel I.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 17
(3,823 Views)

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.)

0 Kudos
Message 5 of 17
(3,818 Views)

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

 

0 Kudos
Message 6 of 17
(3,815 Views)

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,

 

Joel I.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 17
(3,788 Views)

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.

0 Kudos
Message 8 of 17
(3,782 Views)

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,

 

Joel I.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 17
(3,764 Views)

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

0 Kudos
Message 10 of 17
(3,757 Views)