This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

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

Updated Jan 17, 2023

Reported In

Software

  • 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?

Solution

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 Client.vi:

Figure 2. SMTP Shipping Example

Additional Information

If you cannot send Email by using Gmail or you receive security message from Gmail secretariat, you may need to check the security setting in your Gmail account. You need to enable the access from "low-security application", or LabVIEW. Refer to the appropriate articles how to do this.