Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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/ 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(''); $message->Subject('Test'); $message->Body('Test Message'); $message->Attach($file); $message->send; dd [ $message->display ];

Replies are listed 'Best First'.
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


      cpan i Mail::Outlook

      from your command line.Thanks a lot for your suggestions

        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.

        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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1007015]
Approved by kcott
[Corion]: :-D
[Corion]: I think that ITIL is mostly to prevent people from doing harm to a system that basically runs unattended :)
[Corion]: Maybe you could reduce ITIL to a computer network, a man and a dog. The network runs the computations. The man is there to feed the dog. The dog is there to prevent the man from accessing the computers.
[marto]: from experience of this side of the fence, it's all about proving to people that you are ITIL compliant, then the client ignores logical processes anyway :P
[marto]: when you work on the outside, for a client, you can make them aware of the stupids, but they don' t always listen :/
[Corion]: Yeah, you can lead them to water, but it's illegal to drown them...
[Discipulus]: Here my solution marto: create a win fake machine insied AD. do a micro fake partition foreach remote partition you wont to monit. put a web server that acept from data from remote systems and full fake partition as needed. fake partition are Mb. ;=)

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2017-01-24 10:33 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.