I gave up the MAPI script on login part.
"net use" command had no effect for me.
I rewrite my script using IMAP protocol,
using Net::IMAP::Simple CPAN module,
and it runs fine.
I strongly feel this script is much easier.
#!Perl
use strict;
use Net::IMAP::Simple;
my $imap = Net::IMAP::Simple->new("myexsvr.co.jp", port => 143,
timeout => 90) or die "$Net::IMAP::Simple::errstr\n";
if($imap){
print "Connected.\n";
} else {
print "Connection failed: $Net::IMAP::Simple::errstr\n";
exit;
}
if(!$imap->login('[EMAIL PROTECTED]', 'pass')){
print "Login failed: " . $imap->errstr . "\n";
exit;
} else {
print "Login OK\n";
my $msgs = $imap->select("INBOX");
print "Messages in INBOX: $msgs\n";
}
# go through top 3 messages in the selected folder
print "go through 3 messages\n";
for my $msg (1..3) {
# get the message, returned as a reference to an array of lines
my $lines = $imap->get($msg);
# print it
for (@$lines) {
print if m{^(Date|From|Subject): };
}
print "Will delete it!\n";
my $rc = $imap->delete($msg);
print "\$rc=$rc\n";
}
print "expunge_mailbox...\n";
my $rc = $imap->expunge_mailbox("INBOX");
print "\$rc=$rc\n";
$imap->quit;
__END__
Regards,
Hirosi Taguti
[EMAIL PROTECTED]
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Chris Wagner
> Sent: Wednesday, September 14, 2005 11:18 PM
> To: [email protected]
> Subject: Re: Logon with MAPI
>
> I would deal with it by first issuing a net use
> \\server\ipc$. Not elegant
> but it should work. Ja.
>
> At 10:40 AM 9/13/05 +0900, [EMAIL PROTECTED] wrote:
> >Hello, I almost finished a script to delete old msgs
> >with MAPI, but first "$session->Logon" cause popup for password.
> >This box says "connecting OUR.EXCHANGE.SEVER".
> >
> >The creator of Outlook Redemption says:
> >http://www.dimastr.com/redemption/
> >That is not an Outlook security popup (that Redemption deals with),
> >it is a login dialog that is shown by Windows itself when an
> RPC channel
> >is opened.
> >To avoid it you would either need to be logged in as that user or
> >impersonate thee user in question using
> >LogonUser/ImpersonateLoggenOnUser Windows API function.
> >
> >I failed to do it with Win32::AdminMisc::LogonAsUser.
> >Can it be used for RPC channelopeng?
>
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs