NYCPHP Meetup

NYPHP.org

[nycphp-talk] Re: Monitoring for Bounce Mail

Faber Fedor faber at linuxnj.com
Thu Apr 28 21:35:34 EDT 2005


On 28/04/05 21:22 -0400, John Nunez wrote:
> I manage a mailing list that started with just 64 names and it is now 
> at 10,000+ addresses.  In the past I have been manually removing emails 
> that bounce.  

Remove them how?  From the mail server queue?

> I know that 550 is usually an error with the email 
> address but it there a format that I can use REGEX to get the email so 
> I can remove them?  My only other option would be to just remove any 
> matching email address.

If you're removing emails from the queue, it woulddepend on what mail
server you're running.   If you use Postfix, this little script might do
it for you:

<----------------------------------< cut here >-------------------->
#!/bin/sh
#
# Quick and dirty script to stop a mail flood from <sender>. - F^2
# 2004-01-05
#
# usage: ./stop_mail_flood <sender>
#

if [ -z "$1" ]; then
        echo -e  "\nusage: $0 <sender>\n"
        exit
fi

service postfix stop

postqueue -p| grep $1 | awk '{print $1 }' | grep -v $1 | sed -e 's/*//'| awk \
'{ print  "find /var/spool/postfix -name " $1 " -exec rm {} \\;"} '  | sh

service postfix start
<----------------------------------< cut here >-------------------->

Although using postsuper would be better as in the following script
(which delete all emails in the queue; I really need o combine these two
someday):

<----------------------------------< cut here >-------------------->
#!/bin/sh

echo "Clearing mail queue..."

service postfix stop

for qid in $(postqueue -p | egrep -v '(^  *|^$)' | awk '{print $1}' \
| sed -e '1d' -e '/\*$/d' -e '/--/d')
do
        postsuper -d $qid
done

service postfix start
<----------------------------------< cut here >-------------------->

HTH

-- 
 
Regards,
 
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701

http://www.linuxnj.com






More information about the talk mailing list