This is a simple question. I have a little program here that reads a list of emails in a specific inbox of a user account specified by the program. I can access an account using its username, password and host. The only problem is I don't know how to get the date on each of these mails.
Here's some part of my code:
my $pop = new Mail::POP3Client(
USER => $user, #some user,password & host assigned
PASSWORD => $pass,
HOST => $host );
for( $i = 1; $i <= $pop->Count(); $i++ ) {
@header = $pop->Head($i);
@body = $pop->Body($i);
$mail = new Mail::MboxParser::Mail(\@header, \@body);
$user_email = $mail->from()->{email
print "Email:".$user_email; #this prints out right
foreach( $pop->Head( $i ) ) {
/^(Date):\s+/i && print $_, "\n";
$date = $_;
}
}
Now what i need is to get the only one date for each email, but that loop gives me all.. but when remove the loop, it returns an error. I'm using Perl.
Kindly help me? :)