Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: is it possible to use Perl to process Outlook emails?

by cjb (Friar)
on Jul 26, 2011 at 14:08 UTC ( #916778=note: print w/replies, xml ) Need Help??


in reply to Re^2: is it possible to use Perl to process Outlook emails?
in thread is it possible to use Perl to process Outlook emails?

Your exchnage sever may have POP3 mail box access set up. If it has it's fairly easy to get Mail::POP3Client to grab the mail. I've had to do this recently:
#!c:\strawberry\perl\bin\perl.exe 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"; }
Edit 27/07/2011@10:33BST Removed reference to subroutine not include in code &return_error and replaced with die

Replies are listed 'Best First'.
Re^4: is it possible to use Perl to process Outlook emails?
by Anonymous Monk on Nov 07, 2014 at 16:30 UTC
    I tried to run this routine. The error message was: "unable to connect to POP3 server: couldn't connect socket exchange3, 110; Invalid argument." Any advise will be appreciated. Thanks in advance.
      So you don't have a server named "exchange" ... what is the name of your server?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://916778]
help
Chatterbox?
[davido]: And remember; time is hard. :) As soon as you think, I've got this, you'll discover that time is harder than that. :)
[1nickt]: TCLion are you parsing the dates with DateTime or another tool?
[1nickt]: I note DateTime::Format:: Flexible, announced immediately below this box in the CPAN feed
[Corion]: 1nickt: That one sounds sensible as it will tell you when it found an error
[1nickt]: Throws on error, I believe
[1nickt]: But should handle month as number or word

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (19)
As of 2017-03-23 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (287 votes). Check out past polls.