简体   繁体   中英

How can I handle multiple outlook accounts using Perl

我的任务是使用 perl 从 Outlook 的辅助邮件帐户读取邮件。


Please check the following it may help you.But you should install respective modules.Reference from " http://www.perlmonks.org/?node_id=916759 "

use Modern::Perl;
use Mail::POP3Client;
use MIME::QuotedPrint;

my $pop_user = 'XXXXXXXXXX';
my $pop_pass = 'XXXXXXXXXX';
my $pop_host = 'exchange3';

#connect to POP3 sever
my $pop = new Mail::POP3Client    ( HOST => $pop_host );
$pop->User($pop_user);
$pop->Pass($pop_pass);
$pop->Connect() 
    or die "Unable to connect to POP3 server: ".$pop->Message()."\n";

#count number of items in POP3 mailbox                                
my $mailcount = $pop->Count();

for (my $i = 1; $i <= $mailcount ; $i++) {
    my $header = $pop->Head($i); #gets the header
    my $uni = $pop->Uidl($i); # gets the unquie id
    my $body = $pop->Body($i);
    $body = decode_qp($body); #decode quoted printable body
    say "$uni";
    say "$header\n";
    say "$body";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM