Two ways come to mind:

1. Use Net::SMTP to send the email.

2. Since you are using Exchange, you can create a special public folder
"Outlook Security Settings" with a special item in it that controls
Outlook security. You'll have to see the Outlook docs for more info.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bob Davis
Sent: Tuesday, April 19, 2005 9:44 PM
To: [email protected]
Subject: cdo win32-ole "object model guard"


Hi

I have a perl program that sends email via win32-ole cdo.
I started having the 2 dialogs since "upgrading" :-( to outlook 2003.
The dialogs read: 1. A program is trying to access e-mail addresses you
have stored in 
Outlook. Do you want to allow this?
2. A program is trying to automatically send e-mail on your behalf. Do 
you want to allow this?

The last one with the 5 second delay. I have read that this is called 
"object model guard" and there is no registry setting to turn it off. 
Since this is a work computer I can not uninstall outlook 2003. I have 
also read that extended mapi can prevent this error. I have a C++ 
program that uses extended mapi to get the addresses of names and this 
doesnt trigger the dialogs.

So I want to change my perl code so it doesnt ask for the 2 dialogs. 
Anybody have any suggestions?

Here is the code which basically listens for smtp connections and 
forwards the email to exchange. I have snipped the smtp portion to keep 
it brief. If anybody wants the ocde I can include the whole program.


use Win32::OLE;
use Net::SMTP::Server;
use Net::SMTP::Server::Client2;

my $name = "Microsoft Outlook Internet Settings";

Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE) ;
die "Coinitialize error", Win32::OLE->LastError(),"\n" if 
Win32::OLE->LastError();

$Session = Win32::OLE->new('MAPI.Session');
die "Could not create a MAPI Session: $!", Win32::OLE->LastError(),"\n" 
if Win32::OLE->LastError();
$Session->Logon($name, "");
die "Could not login: ", Win32::OLE->LastError(),"\n" if 
Win32::OLE->LastError();

my $message = $Session->Outbox->Messages->Add($Subject, $Body);

for my $recp (@{$client->{TO}}) {
   my $recipient = $message->Recipients->Add;
   $recipient->{Name} = $recp;
   $recipient->{Type} = 1; # 1 = "To:", 2 = "Cc:", 3 = "Bcc:"
   $recipient->Resolve();
}
$message->Send(1, 0, 0); _______________________________________________
Perl-Win32-Users mailing list [email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to