procmail
[Top] [All Lists]

extract receivers address from host address and forward message

2003-12-02 05:11:34
I want to do the following:

- When I receive a message at my(_at_)email(_dot_)com  from 
acertain(_at_)person(_dot_)com 
- I want to extract the "my" from my(_at_)email(_dot_)com and forward the 
message to my(_at_)anotheremail(_dot_)com 
- The "my" can be variable so if I receive the message at 
my2(_at_)email(_dot_)com I want to forward it to 
my2(_at_)anotheremail(_dot_)com (but only if the message is from 
acertain(_at_)person(_dot_)com)
- The return address (if server is down) must be 
alwaysthesame(_at_)email(_dot_)com

I made the following procmail script by searching for examples on the internet 
and was wondering if this is correct:

:0
#Extract the receivers address from host address
* TO_=`formail -rt -xTo: \
         | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

#check if it's from a certain person's address
* ! ^From acertain(_at_)person(_dot_)com

#This line is something my hosting company put in another script to test if it 
works, I think I should leave it in there
 
| /usr/bin/formail -I "From " | /opt/server/bin/deliver -a useraccount01 |

#Forward the message 
$SENDMAIL "${TO_}(_at_)anotheremail(_dot_)com" -f 
alwaysthesame(_at_)email(_dot_)com

Am I handeling this correctly?

Thanks for any input.

Regards Danielle
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>