Jump to content

SEND A MESSAGE WITH THE DEFAULT E-MAIL PROGRAM


Recommended Posts

Hello users of LabVIEW,

I want to send a file in program but I would like to use the default program of the user of the computer, for example Outlook or Thunderbird.

Thanks

Step 1: turn off CAPS LOCK

Step 2: RTFM (try a LabVIEW example search for SMTP)

Step 3: Rinse and repeat

Link to comment

You would be well advised to use the SMTP examples as crelf suggests.

However, if you really want to use OutLook (not advised, Thunderbird ... well, lets not get into religious discussions...) you will have to educate yourself on the object models used by MS Office and Outlook. For a good simple example of this type of stuff look in the ..\LabVIEW x.x\Examples\Comm folder for the files in ExcellExamples.llb or smtpex.llb

:book:

ActiveX Automation

You cannot just use systemexec and throw a filename at OutLook, you'll have to get an application reference to OutLook, then create all the various objects, subitems, etc like a document, recipient, attachment(s), etc

Once you have all this stuff created you have to assemble it properly and then run the OutLook method to send it. Since the coffee is pretty good this morning I've attached a scratchpad VI with a few of the object refs, methods and properties. This is by no means complete and isn't even wired up. Just loose tinker toys for you to play with.

If you really want to do this, go knock yourself out, but I'm guessing you get bored or frustrated and go back to the built in email VIs/examples pretty quick. :throwpc: If not, be sure to post up here what you come up with for the benefit of others who will (then) have less experience than yourself.

Download File:post-45-1149875032.vi

Don't say we didn't warn you

PS: Dispite the discouragement from "experts" like crelf and myself, please note my signoff block and take it to heart, I wouldn't mind seeing someone with lots of time and energy and determination grind through this problem, with OutLook and/or Thunderbird. If you actually finish this we'd be happy to doff our hats and hoist a foamy or two in your honor.

Link to comment

Hi,

With SMTP VIs of NI it's necesary to put some parameters like server address and that it's supposed to be configured en the client's computer if he's got internet conection.

I wanted to do easier the client's life to send me some information to my company by an e-mail. I don't know the configuration of his SMTP server.

I've done an VI who opens the user's default program to send e-mails with some parameters. It uses two dlls: user32.dll and shell32.dll. Within this dlls I use only two functions and their explanations are in the VI. The text is from Microsoft website:

http://msdn.microsoft.com/library/default....shellwindow.asp

http://msdn.microsoft.com/library/default....hellexecute.asp

To understand all of this better you've got this links:

http://www.ml-consult.co.uk/foxst-26.htm

http://www.ml-consult.co.uk/foxst-22.htm

They are not about LabVIEW but they help to understand the use of the function ShellExecute()

Note: Run applications can made with ActiveX and .NET. Shell32.dll is an classes library and you can create a reference to this library with 'Automation Refnum' in LabVIEW. In the following link says something about this but it's in Spanish, sorry.

http://www.elguille.info/vb/ejemplos/Shell....htm#listaShell

Download File:post-4923-1150124570.vi

Link to comment

JdP,

Although I'd still love to see (someone else :P ) create a nice OutLook &/or Thunderbird API,

I officially doff my hat and hoist :beer: :beer: :beer:

You solution is simple, direct and I suspect might even have an almost direct analogue on the MAC.

Thanks for posting your (better) solution,

Cheers,

Mike

Link to comment

Nice work from JdP indeed. This is what most Windows programmers do not seem to like very much but which is very common on Unix. Just call the other program directly with some parameters. It keeps everything rather simple by using standardized interfaces, leaves specific functionality to the tools that can do them best and follows the KISS principle.

Although I'd still love to see (someone else :P ) create a nice OutLook &/or Thunderbird API,

Right, I undersign the (someone else :P ) part! I'm not a masochist and doing Active X on MS Office applications is aiming for a moving target! Not much fun at all!

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.