I'm changing my email address soon (the old one doesn't have
server-side spam filtering), and am thinking of using the following
bit of procmail code. Can I replace sendmail with an mbox name (to
send these messages by hand) and expect things to work?
SUBJ_=`formail -c -xSubject: \
| sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
:0
# Was it to me
* ^To(_dot_)*myoldid(_at_)myoldhost\(_dot_)myolddom
# Ignore messages for daemons
* ! ^FROM_DAEMON
# Avoid email loops
* ! ^X-Loop: myid(_at_)myhost\(_dot_)mydom
{
:0 c
! myid(_at_)myhost(_dot_)mydom
:0:dejatold.lock
| formail -rD 8192 dejatold.cache
:0 eh
| (formail -r \
-A"X-Loop: myid(_at_)myhost(_dot_)mydom" \
-I"Subject: Changed email address" ; \
echo "Dear Sender," ; \
echo "" ; \
echo "Thank you for your email about" ; \
echo "\"${SUBJ_}\"" ; \
echo "" ; \
echo "My email address has changed." ; \
echo "Old: myoldid(_at_)myoldhost(_dot_)myolddom" ; \
echo "New: myid(_at_)myhost(_dot_)mydom" ; \
echo "Your email has been forwarded to my new address." ) \
| /usr/lib/sendmail -oi -t
}
--
Stephen Patterson http://www.lexx.uklinux.net/
s(_dot_)patterson(_at_)SPAM(_dot_)freeuk(_dot_)com (remove spam to reply)
ICBM address 54-22-0N 0-28-0W Linux Counter No: 142831
GPG Public key: 252B8B37 available on public keyservers.
pgpfVHt4mPkKu.pgp
Description: PGP signature