LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET SMTP email in executable

I'm trying send email via SMTP.
LabVIEW SMTP example doesn't work (no error, but no email)
This code works successfully in edit mode.

smtp.png

 

 

 

 

 

 

 

 

But in exe I get this error

smtp_error.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

"Inner Exception: System.Net.Sockets.SocketException: An attempt was made to access the socket with a method that was denied access rights"

what does it mean?
exe and vi works in one login session, without Admin rights.
How to fix this error?

0 Kudos
Message 1 of 8
(3,060 Views)

screenshots are completely useless

0 Kudos
Message 2 of 8
(3,021 Views)

@nyc_(is_out_of_here) wrote:

screenshots are completely useless


In his defence, it is a code snippet.

0 Kudos
Message 3 of 8
(3,010 Views)

It looks like one, but I wasn't able to get LabVIEW to import it properly, can anyone else?

0 Kudos
Message 4 of 8
(3,004 Views)

@arteitle wrote:

It looks like one, but I wasn't able to get LabVIEW to import it properly, can anyone else?


It's everyone. But it's not his fault. It's a problem with downloading the images and how you do it. See:

https://forums.ni.com/t5/Feedback-on-NI-Community/Snippets-are-broken/td-p/3658760/page/3

0 Kudos
Message 5 of 8
(2,999 Views)

Artem,

 

When you try running the exe as an administrator, do you receive the same error?

 

Also, I see you're using port 25. That port is blocked by some firewall/anti-virus software and even some ISP's will block it to prevent spam. You can read a little more info about it here:

 

"Errors with SMTP Email VIs": http://digital.ni.com/public.nsf/allkb/42556976302AFF3C86256D7C0080AB5C

 

Regards,

Applications Engineering
National Instruments
0 Kudos
Message 6 of 8
(2,992 Views)

Most likely your SMTP Client configuration is not correct. See this note on MSDN about the parameters for the SmtpClient constructor:

 

The host and port parameters set the value of the Host and Port properties, respectively. If host is null or equal to String.EmptyHost is initialized using the settings in the application or machine configuration files. If port is zero, Port is initialized using the settings in the application or machine configuration files. The Credentials property is initialized using the settings in the application or machine configuration files.

 

Are you sure you have a configuration for your executable application or a valid machine configuration for the email server on the machine you try to run your executable?

 

Unless you have mail configured on your computer you most likely don't have a valid machine configuration for SmtpClient and it is unlikely that you have a valid smtp configuration added to your LabVIEW schema file.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 8
(2,977 Views)

Thanks for the support and advice.
The settings are correct. LabVIEW successfully sends messages, the problem is only with exe.
I consulted with the system administrator. Problems in the settings of the firewall.

0 Kudos
Message 8 of 8
(2,957 Views)