Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   Retrieve mail using perl plz help me (http://www.go4expert.com/forums/retrieve-mail-using-perl-plz-help-t20016/)

rahul_mawana 7Nov2009 09:05

Retrieve mail using perl plz help me
 
Hello frnds,
I am trying to makd a perl propram by that i can retrieve my email from a server that requires SSL
authentication. I used
Net::POP3 and I tried all the
different types of logging in such as auth(..), login(..),
which are sub routines defined in
Net::POP3.
But not working plz tell me any method or perl module by that i can retrive mail.
Thanks

murugaperumal 25Feb2010 11:41

Re: Retrieve mail using perl plz help me
 
Dear Friend,

You can use the following modules

Mail::POP3Client

It will help your requirement.

ungalnanban 2Mar2010 10:20

Re: Retrieve mail using perl plz help me
 
Refer the following link

http://bumppo.net/lists/macperl-webcgi/2000/05/msg00027.html

murugaperumal 4Mar2010 09:35

Re: Retrieve mail using perl plz help me
 
You can use the following code

Code:


 use warnings;
use strict;
use Mail::POP3Client;
use lib "/home/murugaperumal/.perl_m/share/perl/5.8.8/" ;
use IO::Socket::SSL;
use CGI qw(:standard);
my $cgi = new CGI;
my $LOG ;
open $LOG , ">>filename" ;
my $username  = 'username@gmail.com';
my $password  = '********' ;
 chomp($password);
my $mailhost  = 'pop.gmail.com';
my $port      = '995';

$cgi->header();

my $pop = new Mail::POP3Client(
USER    => $username,
PASSWORD => $password,
HOST    => $mailhost,
PORT    => $port,
USESSL  => 'true',
DEBUG    => 0,
);

if (($pop->Count()) < 1) {
exit;
}

print $pop->Count() . " messages found!:$!\n";

for(my $i = 1; $i <= $pop->Count(); $i++) {
 foreach($pop->Head($i)) {
 /^(From|Subject|Email):\s+/i && print $_, "\n";
 }
$pop->BodyToFile($LOG,$i);
}
$pop->Close();
exit;



All times are GMT +5.5. The time now is 05:38.