The following script does pull the sender and Subject of the email but it is not seeing the attachment name. I know there is an attachment.
I line in red SHOULD pull the filename out.
this line is in the message:
Content-Disposition: attachment; filename="Picture 243.jpg"
#!/usr/bin/perl
use Mail::POP3Client;
$pop = new Mail::POP3Client( USER => "someusername",
PASSWORD => "somepasswot",
HOST => "mail.somedomain.com" ) || die "Error";
print "Messages:".$pop->Count()."\n";
for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->HeadAndBody( $i ) ) {
#/^(From|Subject):\s+/i and print $_, "\n";
/^From:\s+/i and @from = split(/:/);
/^Subject:\s+/i and @subject = split(/:/);
/^Content-Disposition: attachment;\s+/i and @filename = split(/=/);
}
print "From: $from[1]\n";
print "Subject: $subject[1]\n";
print "Attachement: $filename[1]\n";
print ;
print "\n*************************************************\n";
}
$pop->close;