03-22-2010 12:02 AM
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
Solved! Go to Solution.
03-22-2010 04:08 AM - edited 03-22-2010 04:09 AM
03-22-2010 04:21 AM
03-22-2010 04:40 PM
In case you only have the base version, you cannot use the Internet library .
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/
04-01-2010 10:25 PM
@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.
04-01-2010 11:57 PM
@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
04-02-2010 12:40 AM
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.
04-02-2010 12:25 PM
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
04-03-2010 11:27 AM
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,