LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

System_Net_Mail_SmtpClient_Send and InetSendMail

I am getting "Error in sending mail" with both System_Net_Mail_SmtpClient_Send and InetSendMail. 

 

My IT has told me that the ports are open.  I have disable the McAfee virus scan.

I can ping, telnet into the host.

 

What other problems can cause this error?

0 Kudos
Message 1 of 6
(4,318 Views)

Paul,

 

A few things could be causing that problem. First of all check to make sure that your to addresses are well formatting and legal email addresses in the form of username@host.name. If they are not you will get this error -13. Beyond that, try sending an email through Outlook or another mail application to check to make sure that smtp server is functioning correctly. Does your smtp server require authentication or use SSL? The InetSendMail function will only work with open smtp servers.

 

Are you sending any attachments with the mail? Try using the shipping example program sendmail (CVI\samples\internet\sendmail\sendmail.cws) to make sure your code is formatted correctly.

 

Finally, in your System_Net_Mail_SmtpClient_Send example are you calling Initialize_System() first to to initialize the system assemblies?

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

0 Kudos
Message 2 of 6
(4,304 Views)

Steven,

 

The addresses are formatted correctly.  The smtp server requires SSL that is why I went to the System_Net_Mail.  I do call Initialize_System at the beginning of the function.  I am not sending an attachment yet, I wanted to get a simple message out first.

 

I have tried using the System_Net_Mail_SmtpClient_Set_UseDefaultCredentials(TRUE) and System_Net_Mail_SmtpClient_Set_EnableSsl(TRUE) to try to authenicate to the server.

 

I have also tried to use the System_Net_NetworkCredential__Create_1 to create my NT Login and password as the credentials.

Nothing worked.

 

I have a feeling that the smtp server is not authenicating me correctly.  But IT always believes it is an issue on the user end until all options have been exhausted.

 

Paul

0 Kudos
Message 3 of 6
(4,299 Views)

can you spy on the communication ? either by installing a local proxy or by using a network capture tool like WireShark.

the SMTP protocol is an ASCII protocol and is quite simple. the communication log would allow us to tell you what is going wrong, and make the right suggestion about how to correct the problem.

0 Kudos
Message 4 of 6
(4,295 Views)
Can't install anything on my laptop, IT has limited access.  Is there anyway to get to the communication log directly from Windows or CVI?
0 Kudos
Message 5 of 6
(4,285 Views)

it may be a little bit of work, but you can write a proxy yourself: open a tcp server on the right port (25 for smtp, i don't remember for SSL or others), listen to connections, when someone connects open the remote connection to the real mail server then you need 2 threads: one reads incoming data from your program and write them to the real server, the other reads data from the real server and write them to your local program. of course, the 2 threads have to somehow dump what they are seeing to a file.

 

i am pretty sure you can find a program on the internet that performs this without needing any installation.

 

note that it will allow to diagnose a problem only with plain-text smtp or with TLS authentication. unfortunately SSL communication will not work (well, technically speaking you can make it work like in a man-in-the-middle attack, but that is a lot of work only for debugging).

 

ho by the way... outlook express had an option to log network traffic in previous versions. i don't know if it still exists but it may help you the easy way.

0 Kudos
Message 6 of 6
(4,270 Views)