programming-examples/perl/Network/use Mail_POP3Client to send an email out.pl

21 lines
433 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use Mail::POP3Client;
$mail = new Mail::POP3Client("username", "password",
"pop3.yourserver.com");
if ($mail->Count) {
print "You have ", $mail->Count, " new message(s).\n";
print "Storing message(s) to disk.\n";
open FILEHANDLE, ">file.txt";
for($loop_index = 1; $loop_index <= $mail->Count; $loop_index++) {
print FILEHANDLE $mail->HeadAndBody(1);
}
close FILEHANDLE;
}