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

Hello Monks, I want to write a script that should use outlook to send message. I google this and found there is command line option for outlook e.g
Outlook.exe /a C:\test.txt /c ipm.note /m test@yahoo.com,
but this opens a new window of outlook and you have to click on SEND button, but i want to send mails to multiple clients without pressing this button.

Replies are listed 'Best First'.
Re: Scripts that should use outlook.exe to send mails
by marto (Cardinal) on Oct 20, 2010 at 12:46 UTC

    Are you sure you want to automate Outlook rather than send mail via a perl script using the same account/Exchange/mail server? See MIME::Lite.

Re: Scripts that should use outlook.exe to send mails
by locked_user sundialsvc4 (Abbot) on Oct 20, 2010 at 13:12 UTC

    ... And if you do want to use “outlook.exe” directly, I believe that you will find that Outlook has a well-featured OLE interface.   You should be able to refer to “the Outlook application,” “mailboxes,” “messages,” and pretty much every other “thing” that Outlook supports, through this mechanism.   And you should encounter no problems at all using this interface with Perl.

    “I normally don’t like to think well of Microsoft Corporation,” he grumbled.   “But this, even I must admit, is A Very Good Hack.™”

    Naturally, the first thing that you should do is to search http://search.cpan.org for the keyword, “Outlook.”   There we find, e.g. Mail::Outlook ...  

    Before setting forth to write anything new in Perl, always make it your business to research what might have already been done, especially in a case like this, where you know you are trodding a well-worn path.   Maybe what you find on CPAN will not be exactly what you’re looking for, but it will be close.