Send Email from LabVIEW via a Secure SMTP Server Such as Gmail

Updated Jan 15, 2019

Reported In


  • LabVIEW Base
  • LabVIEW Full

Issue Details

I would like to have my VI send an email alert, but the only outgoing (SMTP) Email servers I have access to require authentication via Transport Layer Security (TLS) or Secure Sockets Layer (SSL). How can I do this?


LabVIEW 2012 or Earlier
Prior to LabVIEW 2013, there was no native support for sending Email via servers that require authentication; the built-in SMTP vis only worked with open servers.

The Microsoft .NET platform provides a fairly straightforward interface for sending authenticated Email, which older versions of LabVIEW can interface with. The methods to do so exist within the System.SmtpClient class. The Figure 1 below is an example that has been configured to send Email via Gmail accounts. 

The following figure shows the SMTP client configuration for the .NET platform. The new reference control is a placeholder for the MailMessage .NET construction.

Figure 1. SMTP Example Code

LabVIEW 2013 or Later
The SMTP API was changed with the release of LabVIEW 2013 to streamline using secure Email servers. A LabVIEW example can be found at Help»Find Examples»Networking»Internet & Web. The following Figure 2 shows where to find the shipping example Send Email using SMTP

Figure 2. SMTP Shipping Example