Raymond Lam wrote: > > hi there, i've just started reading the book Learning Perl and > I'm amazed what perl can do. > > Currently, I'm trying to find out a way to automatically save > email messages (from MS Exchange / Pop3) to text files in a > directory. > > I am planning to write something in VB but would like to try > perl. Could someone please tell me whether this can be done in > perl so I don't waste time following a dead end.
#!/usr/bin/perl -w use strict; use Net::POP3; my $user_name = 'yourname'; my $user_pw = 'yourpassword'; my $pop_host = 'pop.somehost.com'; my $mail_file = '/home/yourname/mail'; my $pop = Net::POP3->new( $pop_host ) or die "Cannot connect to $pop_host\n"; open my $mail, '>>', $mail_file or die "Cannot open $mail_file: $!"; $pop->login( $user_name, $user_pw ) == 0 and die "No messages at $pop_host\n"; $pop->get( $_, $mail ) for keys %{$pop->list()}; __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]