Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: trouble sending mail

by Adam (Vicar)
on Mar 22, 2001 at 05:34 UTC ( [id://66212]=note: print w/replies, xml ) Need Help??


in reply to trouble sending mail

I think there might be a problem with your CreateItem() method failing to return an object. Since you don't have strict turned on (shame on you!) you didn't find out that $mailitem is not defined. Then you use it as a hash ref, which Perl is happy to do for you. And then you try to call send on a hash ref, not an olMailItem (or whatever).

So the simple answer is, use strict; and check your Ole calls with or die. Be sure to read up on Ole mechanisms and the COM Interface to Outlook. The better answer is open Outlook and figure out where the mail server is. Then use Net::SMTP or MIME::Lite or the like. Doing it this way cuts out the overhead of loading Outlook and eliminates your dependence on both MS and Outlook being installed.

Update:
dws caught the source of your Ole error, the constant, but he didn't give you the right answer for what to do about it. You should import the constants via Ole:

use Win32::OLE::Const; my %olConst = %{ Win32::OLE::Const->Load( "Microsoft Outlook" ) };
Then you can just get them out of that hash table.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://66212]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-23 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found