vios has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perlmonks, I have a question on how I can in Perl open the default email program and open a new window screen, like new email. In all the default Windows programs when you have a browser link or a email link it will launch the default program when clicked on it and in case of email open the new email screen and put in the address. I was wondering on how to do this in Perl. Anybody has any idea ?

Thanks,

Vicky

  • Comment on Launch default email program in Windows

Replies are listed 'Best First'.
Re: Launch default email program in Windows
by bart (Canon) on Nov 11, 2004 at 06:47 UTC
    To Windows, these days, URL protocols are treated similar to file extensions. In fact, the mechanism to use can be the very same as just launching a file in its default program. You could use Win32::API with the ShellExecute API call, but just using the assistant command line tool program start, which comes with Windows, can be enough, and is much simpler to implement. Try this:
    system('start', 'mailto://foo@bar.invalid');
    Works for me. And dead easy.

      Life can be so easy with Perl. :-)

      Works great - Vicky