Broxtor
08-08-2003, 11:22 AM
I want to do some mail filtering before I download messages from my ISP's mail server. Since I haven't found a already working solution to do this, I am trying to write a perl script for this using the Mail::POP3Client module. However, I can't retrieve one single field from the header. I have searched everywhere on the internet, but I didn't find what I'm looking for. The script below gets the headers and displays the From, To, CC and Subject fields of the mail header.
use Mail::POP3Client;
$pop = new Mail::POP3Client("username", "password", "isp.server.com");
for ($i = 1; $i <= $pop->Count; $i++) {
foreach ($pop->Head($i)) {
/^(From|To|Cc|Subject): / and print $_, "\n";
}
print "\n";
}
This works fine. But I want to check the "To" field for certain persons. (My mailbox has an alias, so there can be two different things in the "To" field)
Can anyone tell me how I get the contents of the "To" field in an variable??
use Mail::POP3Client;
$pop = new Mail::POP3Client("username", "password", "isp.server.com");
for ($i = 1; $i <= $pop->Count; $i++) {
foreach ($pop->Head($i)) {
/^(From|To|Cc|Subject): / and print $_, "\n";
}
print "\n";
}
This works fine. But I want to check the "To" field for certain persons. (My mailbox has an alias, so there can be two different things in the "To" field)
Can anyone tell me how I get the contents of the "To" field in an variable??