I assume that the problem is that olMailItem is a constant and not a string

This causes the error:
$myItem = $objApp->CreateItem("olMailItem");

This does not:
$myItem = $objApp->CreateItem(olMailItem);

Of course you have to have:

com.autoregister_typelib = true

in your php.ini or you will need to load the type library manually to define
the constant properly.

Alan.

----- Original Message -----
From: "Scott Hurring" <[EMAIL PROTECTED]>
To: "Php-Win (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 15:44
Subject: RE: [PHP-WIN] Can't figure out how to fix this code...please help


> Well Invoke() failing can mean a few different things.
> 1) That you're requesting something that can't be found
> 2) There's a more serious error (like Outlook already
> being loaded in memory a few times)
>
> What exactly is on line 11/12 of your code?
>
> I just finished writing PHP+COM+Excel program to automatically
> populate and then print out spreadsheets, so i may be able
> to help ya out... but send some more info, thanks.
>
> ---
> Scott Hurring
> Systems Programmer
> EAC Corporation
> [EMAIL PROTECTED]
> Voice: 201-462-2149
> Fax: 201-288-1515
>
> > -----Original Message-----
> > From: R.S. Herhuth [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 17, 2002 3:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Can't figure out how to fix this code...please help
> >
> >
> > This is my code:
> >
> >
> > <?PHP
> > $objApp = new COM("Outlook.Application");
> > $myItem = $objApp->CreateItem("olMailItem");
> > $a=$myItem->Recipients->Add("[EMAIL PROTECTED]");
> > $myItem->Subject="This is a test";
> > $myItem->Body="This is a Body Section now.....!";
> > $myItem->Display();
> > $myItem->Send();
> > ?>
> >
> >
> > This is the error I'm getting...
> >
> >
> > Warning: Invoke() failed: Type mismatch. Argument: 2 in C:\Program
> > Files\Apache Group\Apache2\htdocs\outlook\sendMail.php on line 11
> >
> > Fatal error: Call to a member function on a non-object in C:\Program
> > Files\Apache Group\Apache2\htdocs\outlook\sendMail.php on line 12
> >
> >
> >
> >
> > What did I screw up?
> >
> > Thanks,
> > Ron
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to