I am using Win32::OLE to access my MS Outlook(XP) mail via command line. However, when I do, I get a warning prompt from Outlook (
"Another program is trying to access email addresses you have stored in Outlook. Do you want to Allow this?"). I am trying to get around having to *allow* this process acces every time it runs. Any body know of a way to get around this? Is there a "--force" option I can use somewhere?
Furthermore, I would also like to display this information to a webpage (IIS Web service running as me w/ Admin rights). For some reason whilist browsing this script via browser (with added 'Content-type' etc, etc..) The script Just hangs and I don't get the warning prompt as I do when running the script from the command line. Any thoughts?
I know I shouldn't be serving anything over the web running as myself, I'm just playing around, testing, and wondering why this won't work ;)
Here is the code:
#!/usr/bin/perl
# simplified version
use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Outlook';
my $mailbox = "Mailbox - Silent11";
$Win32::OLE::Warn = 3;
my $outlook = Win32::OLE->new('OutLook.Application','Quit') or
die "Could not created outlook object.";
my $ol = Win32::OLE::Const->Load($outlook);
my $inbox = $outlook->GetNameSpace("MAPI")->Folders($mailbox)->Folders
+("Inbox");
for (in $inbox->{Items}) {
print "Subject : $_->{Subject}\n";
print "Sender : $_->{SenderName}\n";
print "Attachments : $_->{Attachments}{Count}\n";
print "\n\n";
}
-Silent11
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.