Gmail using LabVIEW

Productos y Entorno

Esta sección refleja los productos y el sistema operativo utilizados para crear el ejemplo.

Para descargar el software de NI, incluyendo los productos que se muestran a continuación, visite ni.com/downloads.

    Software

  • LabVIEW

Código y Documentos

Adjunto

Description

Overview

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.

 

 

Description

This VI uses SMTP property nodes in order to write a standard email and send it via a Gmail account.

 

 

Steps to Implement of Execute

Prior to running the code type in all the necessary information.

  1. Leave the Outgoing Mail Server (SMTP) as the default name (smtp.gmail.com)
  2. Add your Gmail Account User ID and Password (FYI: The password is not securely typed and can be accessed in a normal text display from the VI)
  3. Enable SSL (This will send the information securely over the internet)
  4. Sender's Email Address: the email address the email is coming from, Gmail Account
  5. Sender's Name: the name you wish to display as the sender's name in the "from" tag on the receiving email.
  6. Recipient's Email Address: the email address of the person who should receive the email.
  7. Recipient's Name: the name you wish to display as the "to" tag on the receiving email.
  8. CC- Optional: If you would like to add an additional receiver or send a copy to yourself add that email address in the CC String
  9. Subject and Body: Work just like a normal email add your desired text of the email.
  10. Attachment- Optional: This is optional but allows you to attach any file to the email

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.

 

 

Requirements

LabVIEW 2012 (or compatible)

 

 

Additional Information or References

Block Diagram

BD.PNG

 

Front Panel

FP.PNG

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

El código de ejemplo del Intercambio de Código en la Comunidad de NI está autorizado con la licencia MIT. 

Comentarios
TiTou
Trusted Enthusiast
Trusted Enthusiast
el

the code is a bit messy but the function it brings is great !

thanks


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

wbadry
Active Participant
Active Participant
el

Nice Post G-Money. Very Helpful indeed

Waleed El-Badry MSc.,MCPD, ISTQB Certified Tester
Assistant Lecturer
Mechatronics Department
Faculty of Engineering
Misr University for Science & Technology



View Waleed El-Badry's profile on LinkedIn

M1014757
Member
Member
el

Hi  G- Money ,

its very helpful

Branson
Member
Member
el

wow, very helpful!

duyson
Member
Member
el

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!

Son

email: tongduysonth@yahoo.com

todd.davis
Member
Member
el

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?

Thanks

Gregoiree
Member
Member
el

Hello,

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

Thanks

dannnyds2
Member
Member
el

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

Dan

dannnyds@gmail.com

StudMuffin
Member
Member
el

Does anyone know how to send Microsoft Outlook Task Requests through a VI?

effgee
Member
Member
el

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

FernandoL
Member
Member
el

very good man!!!

si funciona ya habia probado los otros que hay por aca mismo y nada pero porfin salio.... Gracias.!!!

Best Regards.
Ing. Edgar Lojan
IPTN
Member
Member
el

Awesome

SaidElshayeb
Member
Member
el

Gr8 thanks

Lecturer
Machanical Power Department
Helwan University, Egypt
m.meadows
Member
Member
el

Sorry if this is a basic question. Do you know if this vi works on the 2009 OS X version?

TiTou
Trusted Enthusiast
Trusted Enthusiast
el

It doesn't work on Mac OS X because it uses .NET which is windows only.

Sorry


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

m.meadows
Member
Member
el

Ahh missed that. Thank you.

Brinoceros
NI Employee (retired)
el

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

Brian A.
National Instruments
Applications Engineer
Arturo_M._Gomez
NI Employee (retired)
el

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

Arturo Gómez | Applications Engineering
Certified LabVIEW Associated Developer

National Instruments Latin America
01-800-010-0793
ni.com/support
Terry_ALE
Active Participant Active Participant
Active Participant
el

Brinoceros, Doesn't SSL take care of encrypting the credentials?


Certified LabVIEW Architect, Certified Professional Instructor
ALE Consultants

Introduction to LabVIEW FPGA for RF, Radar, and Electronic Warfare Applications
Heckler511
Member
Member
el

Sweet!  Thanks for the posting

Brinoceros
NI Employee (retired)
el

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.

Brian A.
National Instruments
Applications Engineer
Delber1
Member
Member
el

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?

Rocio_
Member
Member
el

Great VI. Thank you!

rick s.
Member
Member
el

Very useful. Thanks for the great post!

amitlipman
Member
Member
el

Hey Antoine,

Did you find a way to send emails through gmail using Mac? or email through any other server (using Mac)?

All the best,

Amit

Mr_J
Member
Member
el

Thank you for this vi.

To well close the attached file after sent, just add the Dispose.

dispose.jpg

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.

++

kenes_fusa
Member
Member
el

great vi. thank you!

Hong.Zhang@agresearch.co.
Member
Member
el

Hi Mr_j

Do you know how to receiving email by using Labview?

Thanks

G-Money
NI Employee (retired)
el
Hong.Zhang@agresearch.co.
Member
Member
el

Hi Grant

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

error 56.jpg

Hong.Zhang@agresearch.co.
Member
Member
el

Hi Grant

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

Port:465

SSL: on

User name: XXXXX

Passsword: ********

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.

Thanks

Hong

error 1172.jpg

Miro_T
NI Employee (retired)
el

Hi,

Did you check "Possible reason(s)" paragraph in your screen shot?

Also, were there any changes to your .NET assembly ?

razso
Member
Member
el

THANK A LOT!!

MAY GOD BLESS ON U!!

razso
Member
Member
el

did u had solve this problem?

i also get this error after sending a few massage..

AdeLuna
Member
Member
el

Hi!

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

please help!

razso
Member
Member
el

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

5. save..

** u need to log in first your gmail account google web before send email using labview.. this labview gmail unable to send attachment..gmail setting.png

JamesXu
Member
Member
el

Hi Grant:

     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.

3.bmp

Jepz
Member
Member
el

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.

Best regards,

Jep

HORSZI
Member
Member
el

Hy!

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!!

Szilárd

lf19902001Wahah
Member
Member
el

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 ?

lf19902001Wahah
Member
Member
el

Check Jepz's reply.

jrvinck
Member
Member
el

did you find a soltion for your problem im getting the same error

lf19902001Wahah
Member
Member
el

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.

Easterly81
Member
Member
el

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.

labviewError.bmp

lf19902001Wahah
Member
Member
el

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

Easterly81
Member
Member
el

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

lf19902001Wahah
Member
Member
el

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.

lf19902001Wahah
Member
Member
el

Maybe worth asking this question on Google's forum?

Easterly81
Member
Member
el

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)

emailTEST.bmp

jeasterly
Member
Member
el

It work but not on my windows 2000 machines