LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help for Sending Email with LabWindows 8.5 or 9

Solved!
Go to solution

Hi,

 

I'm trying to send an email with attach excel files to it using InetSendMail function and outlook activeX and always having no success on it.

I am still a student so i dont have much time for researching these functions, so im asking for an example working code for this problem.

Thanks for your the help in advance...

 

I've also tried changing the examples from the package

0 Kudos
Message 1 of 9
(5,007 Views)
Did you refer the internet\sendmail\sendmail.cws example? Did you include cvintwrk.h?
Message Edited by muks on 03-22-2010 02:39 PM
0 Kudos
Message 2 of 9
(5,000 Views)
0 Kudos
Message 3 of 9
(4,997 Views)

In case you only have the base version, you cannot use the Internet library Smiley Mad.

 

The workaround I did was using the sendEmail command line program.  Works perfectly in the background, only thing you need to do is call LaunchExectuable (or a variant of that).  The readme file explains the command line arguments.

 

http://caspian.dotconf.net/menu/Software/SendEmail/

 

 

Message 4 of 9
(4,966 Views)

@muks: i have tried the example program that comes with the software. I tried to use the SMTP server of google and other free SMTP server but didnt work for me.

 

@ngay: i think we are using the full version because the software is from our school and we can control DAQ boards(i heard that only full version can do that).

but anyways, using .NET commands will be so hard for me because i have not much time to study that far. 

 

I just need a simple example program that i can modify to send my excel results in an email. This will be a part of my proj if i can make it work.

 

Thanks guys for your help in advance.

0 Kudos
Message 5 of 9
(4,906 Views)

@ngay

 

 I made the sendmail working but just on the command line... im not really that sure about using Labwindows. can you please send me a simple example code on how to lunch exe from CVI and pass the data required in sendmail.exe

 

Thanks

0 Kudos
Message 6 of 9
(4,901 Views)
Solution
Accepted by topic author panelHandle

Hi,

 

See the help for system and LaunchExecutable(Ex) functions.

It explains how to make command line calls in CVI.

 

You will probably have to build the appropriate command line string using sprintf, Fmt, etc according to your needs.

S. Eren BALCI
IMESTEK
0 Kudos
Message 7 of 9
(4,897 Views)

thanks guys,

I made it work using the sendmail.exe and system() function.

 

but is there anyway i can run the command promp without showing it in the screen and put a flag if the email sending fails? like passing the information in cmd to a message pop up

0 Kudos
Message 8 of 9
(4,874 Views)

Hi,

 

You can use LaunchExecutableEx to determine the window state:

 

LaunchExecutableEx ("command.com /C calc.exe", LE_HIDE, NULL);

 

Beware that this function does not wait for the started executable to exit.

It executes the command in the string and continues.

 

If your application has to get the results of the call, then you need to get the application handle  (3rd parameter, put a variable instead of the NULL above) and call ExecutableHasTerminated in a loop to find out if the execution finished.

 

Read carefully the help for the LaunchExecutableEx function and Handle parameter.

 

To get the result of the command line call, you can add a "> output.txt" parameter to the end of your command line call.

This way all the text output of the command is written to the output.txt file, from which you can read the result.

 

Check the command-line email sender program's help if there is a special paramter to make it more "verbose".

 

Hope this helps, 

S. Eren BALCI
IMESTEK
0 Kudos
Message 9 of 9
(4,861 Views)