Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Trouble using Mail::Outlook

by PerlRocks6345 (Novice)
on Dec 04, 2012 at 06:44 UTC ( #1007015=perlquestion: print w/ replies, xml ) Need Help??
PerlRocks6345 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,I am at a situation to use Mail::Outlook only to send mail.When i send a mail it gets saved in my outbox and the following message gets displayed

OLE exception from "Microsoft Outlook": The item has been moved or deleted. Win32::OLE(0.1709) error 0x80020009: "Exception occurred" in PROPERTYPUT "To" at C:/Perl/site/lib/Mail/Outlook/Message.pm line 380

This is my code..Any suggession will be usefull.Thank you Monks!!!

use strict; use warnings; use Data::Dump; use Mail::Outlook; use Win32::OLE::Const 'Microsoft Outlook'; Win32::OLE->Option(Warn => 3); my $outlook = new Mail::Outlook('Inbox'); my $file = "D:/TEMP2/Text1.txt"; my $message = $outlook->create(); $message->To('me@company.com'); $message->Subject('Test'); $message->Body('Test Message'); $message->Attach($file); $message->send; dd [ $message->display ];

Comment on Trouble using Mail::Outlook
Download Code
Re: Trouble using Mail::Outlook
by ColonelPanic (Friar) on Dec 04, 2012 at 09:57 UTC

    My first thought is: what are you trying to do, and can you do it without calling Outlook?

    Outlook varies greatly between versions. Some versions are very buggy, as I have learned by painful experience (I tried to automate some Outlook functions through VB, only to encounter showstopper bugs in Outlook that killed the entire project). In addition, the Mail::Outlook module has not been updated in several years. That is bound to be problematic as new versions of Outlook come along.

    Here are some other options for sending email:

    This discussion of sending email from Windows, though old, might still be useful.

    In my opinion, unless your task specifically requires Outlook, you will probably do better with a non-Outlook solution.

    Addendum: I did try to install Mail::Outlook and test your code, but the module installation failed. Does this prove my point or only my own laziness? You decide.



    When's the last time you used duct tape on a duct? --Larry Wall

      Hey thanks a lot for your suggestions..My project requires outlook to be integrated to sent mail.My code worked I had to enable "send and receive all folders" in my outlook. It installed pretty well my me, try installing using

       cpan install Mail::Outlook

      or

      cpan i Mail::Outlook

      from your command line.Thanks a lot for your suggestions

        I'm glad to hear that you got it working. I did use CPAN to install--not sure why it failed, but I didn't spend too much time looking into it.


        When's the last time you used duct tape on a duct? --Larry Wall

        Outlook is an email client, why not send emails directly to the target mail server from your script using something like MIME::Lite? As has been explained to you, the Outlook application is not necessary to send emails. Nobody suggested that Mail::Outlook would not install, rather that it hasn't been updated for years, has known bugs and may not work as expected with the version of Outlook you are running.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1007015]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2014-12-20 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls