I've got a mail setup where mail for various domains
is all forwarded to one e-mail address. To make it easier
for me to deal with this I'd like to show the domain
it was sent to in the subject.
Ok .. with the benefit of some advice I came up with
a solution, but its not very pretty:
# Get the recipient.
FROM=`$FORMAIL -xTo:`
# Extract the domain - this should be improved.
# Four processes is too many..
ADDRESSE=`echo $FROM | tr \@ ' ' | awk '{print $2}' | tr \. ' ' | awk
'{print $1}'`
# Modify the subject
:0 fhw
* ! ADDRESSE ?? ^^^^
* ^Subject: *\/[^ ].*
| $FORMAIL -I "Subject: $ADDRESSE - ${MATCH:-<no subject>}"
Steve Kemp
---
Network Administrator / Toolsmith
Voxar Limited
Edinburgh - Corporate Headquarters | Boston | Charlotte | Toronto
Bonnington Bond, 2 Anderson Place, Edinburgh, EH6 5NP, UK
Tel: +44 (0) 131 472 4792 Fax: +44 (0) 131 472 4799
Email: info(_at_)voxar(_dot_)com Web: www.voxar.com
Registered in Scotland No. 145641 Registered Office as above.
This email is sent subject to the legal requirements set out
at www.voxar.com/legal/email_policy.htm