Example Code

Send SMTP Email with .NET

Code and Documents

Attachment

Introducti

This VI mimics the functionality of the SMTP e-mail functions but uses the .NET framework to accomplish the same task. This works with an anonymous server without SSL. For those capabilities, refer to this link.

Steps to Complete

Run the VI attached.


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
MengHuiHanTang
Active Participant
Active Participant
on

I encountered an error when using this VI to send emails. Because the smtpclient instance is not closed properly, if the sending time is too long, eventually the server will time out on the initially established connection. The error message looks like thisSMTP error.JPGTo avoid this, the instance must be properly terminated. I was googling on this, and found out there is smtpclient.dispose() method. But I can not find it in LabVIEW invoke method. Another alternative is Mailmessage.dispose().

Contributors