Currently spam is being send with the From header set to a bunch of random letters at mydomain. I have a catch-all and I have received over 2200 bounces in the past 12 hours.
I wrote a quick script using
Email::Delete to remove the messages from my inbox. The script runs but only process a couple subject lines before hanging. After a few minutes I kill the process with ctrl-c. The code is:
#!/usr/bin/perl -w
use strict;
use Email::Delete qw(delete_message);
my @subject_list = (
'^Delivery Status Notification.*$' ,
'^Undelivered Mail Returned to Sender$' ,
'^failure notice$' ,
'^DELIVERY FAILURE.*$' ,
'^Undeliverable:.*$' ,
'^Returned mail: see transcript for deta.*' ,
);
foreach my $subject (@subject_list) {
print $subject , "\n";
delete_message from => '/home/chad/Mailbox',
matching => sub {
my $message = shift;
$message->header('Subject') =~ m/$subject/;
};
}
The output is:
$ perl remove-bounce-emails.pl
^Delivery Status Notification.*$
^Undelivered Mail Returned to Sender$
^failure notice$
$ perl remove-bounce-emails.pl
^Delivery Status Notification.*$
^Undelivered Mail Returned to Sender$
Any idea why the program is hanging?
top shows the process using next to no CPU time and very little memory.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.