LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending email with LabVIEW prior to 2012

Solved!
Go to solution

Hi guys,

I am trying to use labview to send an email with labview 2010. I was able to get it to work just using the 'STMP Email Send Message' block, but that was when I put in my Microsoft exchange 'MX' value which is on office 365. It worked then, but ONLY on my PC which is on our work network. I tried to use the same mail server input on a different laptop externally and it doesnt work.

I am guessing its to do with the fact my PC is logged into outlook / office 365 and so it doesnt need authentication. But I dont want to use our MX exchange if it means i must log into it on outlook / browser. The following error occurs when sending it on the remote PC with SMTP block: 

 

Error 16500 occurred at 500 5.3.3 Unrecognized command 'Length: 13' [DB3PEPF0000885B.eurprd02.prod.outlook.com 2024-09-02T20:55:40.069Z 08DCC7BE412BE34C]

Possible reason(s):

LabVIEW: (Hex 0x4074) 500 Syntax error, command unrecognized. For example, the command line might be too long.

 

As such I have tried to follow the instructions Send Email from LabVIEW via a Secure SMTP Server Such as Gmail but I cant seem to get it to work. Can anyone show me how or what I am doing wrong. I have attached the VI implementing this, and copied code from another example to do the 'mailmessage' stuff... 

 

I am trying now to use google instead of office365 MX

 

I may have to give up and use an alternative but wanted to do it all within labview (i could make labview write a text file, and have python constantly scan for that file and get python to send email) or buy newer version of labview.

0 Kudos
Message 1 of 13
(836 Views)

There are some good examples of "How to send e-mails using LabVIEW".  LabVIEW needs to be given an SMTP port through which to send the mail, but (again, a network search for "SMTP and gmail" suggests this is possible.

 

LabVIEW 2010 is a decade-and-a-half "out of date", but I did find a reference to using LabVIEW to send gmail in 2009, others who were able to do it much closer to the present date, so I'm guessing that you should be able to try these solutions with LabVIEW 2010.

 

Why don't you see if any of the published code works for you?  If you are missing the VIs in Data Communications, Protocols, SMTP Email, let us know.  If you do have them, write a little test code to send yourself a message via gmail.  Attach your code (not pictures of code, but the actual VIs, better the entire (small) Test Email Project (a folder called "Test Email Project" that contains "Test Email.lvproj" and all the VIs (files with the extension ".vi" and typedefs (extension ".ctl) that you use so we can test it with our version(s) of LabVIEW.

 

Bob Schor

0 Kudos
Message 2 of 13
(802 Views)

@lorc34 wrote:

 

As such I have tried to follow the instructions Send Email from LabVIEW via a Secure SMTP Server Such as Gmail but I cant seem to get it to work. Can anyone show me how or what I am doing wrong.


Google no longer allows using your password from "less secure apps". To work with Gmail, you need to create an application-specific password and use that. I'm guessing that's your issue with Gmail.

 

https://support.google.com/mail/answer/185833?hl=en

 


___________________
Try to take over the world!
0 Kudos
Message 3 of 13
(782 Views)

@tst wrote:

@lorc34 wrote:

 

As such I have tried to follow the instructions Send Email from LabVIEW via a Secure SMTP Server Such as Gmail but I cant seem to get it to work. Can anyone show me how or what I am doing wrong.


Google no longer allows using your password from "less secure apps". To work with Gmail, you need to create an application-specific password and use that. I'm guessing that's your issue with Gmail.

 

https://support.google.com/mail/answer/185833?hl=en

 


Hi Tst,

Whenever I use app passwords, I get the following error: 

 

Error 1172 occurred at Error calling method System.Net.Mail.SmtpClient.Send, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.Net.Mail.SmtpException: Failure sending mail.
Inner Exception: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.)

 

I can try using a different email provider I guess.

0 Kudos
Message 4 of 13
(770 Views)

@Bob_Schor wrote:

There are some good examples of "How to send e-mails using LabVIEW".  LabVIEW needs to be given an SMTP port through which to send the mail, but (again, a network search for "SMTP and gmail" suggests this is possible.

 

LabVIEW 2010 is a decade-and-a-half "out of date", but I did find a reference to using LabVIEW to send gmail in 2009, others who were able to do it much closer to the present date, so I'm guessing that you should be able to try these solutions with LabVIEW 2010.

 

Why don't you see if any of the published code works for you?  If you are missing the VIs in Data Communications, Protocols, SMTP Email, let us know.  If you do have them, write a little test code to send yourself a message via gmail.  Attach your code (not pictures of code, but the actual VIs, better the entire (small) Test Email Project (a folder called "Test Email Project" that contains "Test Email.lvproj" and all the VIs (files with the extension ".vi" and typedefs (extension ".ctl) that you use so we can test it with our version(s) of LabVIEW.

 

Bob Schor


Hi Bob,

 

The SMTP block in Data communications -> Protocols -> SMTP Email does not work for mail servers which require authentication. It states here Send Email from LabVIEW via a Secure SMTP Server Such as Gmail that you can only do this with 'open mail servers'?

0 Kudos
Message 5 of 13
(769 Views)

This link shows how to use SmtpClient to send emails, but it doesnt show how to use MailMessage to generate a 'message'. Possibly this is why I am failing as I tried to use another examples 'Mailmessage' code in combination with 'SmtpClient' code, possibly in the wrong way.

 

I cant find an example which encapsulates all of the code required to send a message. For some reason the labview link below only shows you half the solution. For 'mailmessage' it just says 'do it yourself'

 

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

0 Kudos
Message 6 of 13
(764 Views)

@lorc34 wrote:

 

The SMTP block in Data communications -> Protocols -> SMTP Email does not work for mail servers which require authentication. It states here Send Email from LabVIEW via a Secure SMTP Server Such as Gmail that you can only do this with 'open mail servers'?


A couple of points:

  • My experience has been with LabVIEW 2016 and above.
  • My use of e-mail was to send "warning messages" from a monitoring system I designed to monitor various pieces of equipment in a work environment.  I send from a laptop within the corporate network, and send both within the system and to external e-mail addresses, including text messages (to <phone number>@<provider text address>), yahoo, and gmail.
  • I don't think I did any other "fiddling" with the system.  It has been running for at least the last five years, and we've gotten a few "early warnings" indicating that the system is working.

Bob Schor

0 Kudos
Message 7 of 13
(728 Views)

At my company we have an "internal" mail server, completely firewalled from the outside, which accepts insecure email connections and will pass them on from any "@ourdomain.com" email address in the "From" field.  Try as I might, I couldn't find any other solution than this.  

 

If you don't have an IT/networking department willing to set up something similar, you might be out of luck.

0 Kudos
Message 8 of 13
(721 Views)

@Kyle97330 wrote:

At my company we have an "internal" mail server, completely firewalled from the outside, which accepts insecure email connections and will pass them on from any "@ourdomain.com" email address in the "From" field.  Try as I might, I couldn't find any other solution than this.  

 

If you don't have an IT/networking department willing to set up something similar, you might be out of luck.


Well, the SMTP Send message block which exists in LV2010, works on a PC which is on our work network. The exact same block (albeit on LV8.5, not LV2010) on an external computer at a separate location, doesnt work. I think it may have something to do with our microsoft email server accepting on the work network because it knows the IP address, or I am logged into outlook on the same PC. Not sure 😥

0 Kudos
Message 9 of 13
(716 Views)

Sorry to bring this thread up again but I still havent found a solution.

 

If anyone manages to send an email with a secure mail server with Labview version prior to 2012 please let me know.

 

This article shows how, but does not show how to fully so I am stuck

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LNrSAM&l=en-IE

I would appreciate if u can show me how. Thank you

0 Kudos
Message 10 of 13
(647 Views)