Send an email using Simple Mail Trasfer Protocol (SMTP) to sync up with Gmail. LabVIEW still does not interact with email servers that need authentication, but the System.SmtpClient Class does interact with open email accounts.
This VI uses SMTP property nodes in order to write a standard email and send it via a Gmail account. For more information about SMTP check out this link.
Steps to Implement of Execute
Prior to running the code type in all the necessary information.
Once the email is created push the Run Arrow in order to send the email.
Note: If you receive Error -1172 with this example, try logging into the Gmail account with your browser. This error can occur with Gmail accounts that have been inactive for a period of time. You must log in with a browser and verify CAPTCHA text to reactivate the account.
LabVIEW 2012 (or compatible)
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
the code is a bit messy but the function it brings is great !
We have two ears and one mouth so that we can listen twice as much as we speak.
Hi G- Money ,
its very helpful
wow, very helpful!
Dear G-money. I am doing a project about smart house. I want to use your project in alarming through sending a gmail automatically. How can I integrate your VI to my project. My project is measure temperature and auto alarm through email if the temperature is higher than 50(C). Please give me the advices.
Thank you very much and wish you a nice day!
Thanks for developing this. I am trying to send this via my school's server and get the 1172 error. I retried with my active gmail account and get the 1172 error as well. What else could be the problem?
I'm working with Labview 7.0, .Net Framework 2.0 and Windows 2000 Professional.
I tried to do the equivalent .vi on my software but I had a class conflict betwenn NetworkCredential and SMTPClient.Credentials
May be some one has already fix my problem
i would like to use this vi in my uni project if thats ok. its a VAD monitoring system, and in this case it will allow the person to save their readings and email it to a doctor. the main problem is that i'm having a .NET error, its 1172 but i tried logging into gmail and it still comes up. any ideas?
My error seems to be in the Mail Address block for the reciepiant
Does anyone know how to send Microsoft Outlook Task Requests through a VI?
Thanks for this - can't wait to try it out.
But I can't miss a chance to jump on my hobby horse - images of code are sharper and smaller filesize when saved in PNG (or gif or tif) format; JPG is only intended for photos
very good man!!!
si funciona ya habia probado los otros que hay por aca mismo y nada pero porfin salio.... Gracias.!!!
Sorry if this is a basic question. Do you know if this vi works on the 2009 OS X version?
It doesn't work on Mac OS X because it uses .NET which is windows only.
We have two ears and one mouth so that we can listen twice as much as we speak.
Ahh missed that. Thank you.
Just a warning - According to the MSDN documentation for SmtpClient, any credentials supplied are sent in plain text. This means your username and password are NOT secure if someone happens to be looking
Hey Eric ! how are you, it's been a long time no talking with you. It's a cool example, you save me a lot of programming hours this night LOL
Brinoceros, Doesn't SSL take care of encrypting the credentials?
Sweet! Thanks for the posting
Terry - you're right, I missed that property being set. The session does still start unencrypted, but SSL kicks in before the credentials are sent.
Hey I have been having some issues with this VI in LabView 8.0. I get an error with the smtp client node in the "from" field and LabView says there is a bad terminal or unwired connection. I have a trial version of LabView that can run Gmail86.vi and it runs perfectly fine, but I only have full version of LabView 8.0. Does anybody know how to fix this problem?
Great VI. Thank you!
Very useful. Thanks for the great post!
Did you find a way to send emails through gmail using Mac? or email through any other server (using Mac)?
All the best,
Thank you for this vi.
To well close the attached file after sent, just add the Dispose.
it could create problems if you want to delete one of the attachments you sent, in Labview but also if you try to delete it from Windows.
great vi. thank you!
Do you know how to receiving email by using Labview?
I have donwlanded the mailpop70. When run the Mail Browser.vi got error 56 at POP Read to DOT-CRLF.vi. Please help me. Thanks. Hong
Your code was working very well for poet 25. But now I have to send email and SMS to port 465.
My setting are:
Mail server: send.xtra.co.nz
User name: XXXXX
Those settings are working for outlook. But its dont work for your code now.
I have got error message.
Please help me to fix the problems.
Did you check "Possible reason(s)" paragraph in your screen shot?
Also, were there any changes to your .NET assembly ?
THANK A LOT!!
MAY GOD BLESS ON U!!
did u had solve this problem?
i also get this error after sending a few massage..
I can't send anything 😞
i really appreciate if you could help me
when i'm using the VI an erreos appears me
is the 1172 error, i have no clue how to make it work
1. u need to log in your gmail account
2. go to setting acount
3.click forwarding and pop/imap
4.setting same as picture above...
** u need to log in first your gmail account google web before send email using labview.. this labview gmail unable to send attachment..
Thanks for your vi at first. When i running this vi, it almost occurs error 1172. I have logged in my email, but it has no effects. Anyone can help me? Thanks a lot.
For those who encountered error-1172.
In your gmail account, navigate to settings/security/lesssecureapps and Turn On Access for Less Secure Apps. You should be able to send email without signing in to Gmail.
It was great. The help with less secure app. I have a problem, In a running VI I have a continous sign. When it's high, send a lot of mail from "Send email", but I want to receive just one. I tried to solve this problem with loops, but it didn't work. Do you have an idea anybody? So I want to creat from a continous sign to one rising edge.
Thanks the help before!!
Great VI. Thanks!
Thanks, Jepz! That's right solution for the Error -1172!
I found that if you use Outlook.com account, you won't have this problem. Does this mean Outlook.com use less secure sign-in technology compared with google ?
did you find a soltion for your problem im getting the same error
In your gmail account, navigate to settings/security/lesssecureapps and
Turn On Access for Less Secure Apps. You should be able to send email
without signing in to Gmail.
If you use Outlook.com account, you won't have this problem.
Recently this VI stop working from me. I checked my gmail "settings/security/lesssecureapps". Any reason this would stop functioning on all my machines? I set up my gmail account in outlook on one of the machines today and outlook send email out just fine. Any help would be appreciated.
>> I checked my gmail "settings/security/lesssecureapps"
Did you turn it on or off? The "Access for Less Secure Apps" option should
be turned on.
Yes, the first thing I did was signed up for a new gmail account because the old gmail account that all the machines were using nobody knew the password. With the new Gmail account setup up with the less secure apps setting turned on still non of the machines send email.
I am using labview 8.0
If you have turned on the less secure apps setting, I don't know what else
you can do to solve this problem. But this is strange, the program works
well on my computer. I use LabView 2013. OS: Win7.
Maybe worth asking this question on Google's forum?
I'm using windows 2000 with labview 8, could this be the problem? I just tried using a outlook.com email account and ran into the same issue. I even made a simple test VI and still no luck (i tried port 25 and 587)
It work but not on my windows 2000 machines