1
0

rewrite.direct 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #
  2. # sample rewrite file for systems that send and receive mail directly.
  3. #
  4. # by default, the return address points to this system; if you have multiple systems
  5. # and don't want them all to be mail recipients, set $site to a generic
  6. # name (e.g., plan9) or system name in /rc/bin/termrc and /rc/bin/cpurc
  7. # and put an MX DNS record in /lib/ndb to point to that system.
  8. #
  9. # replace YOURDOMAIN.DOM in the following rules with your domain name.
  10. # translate local aliases from /mail/lib/namefiles
  11. [^!@.]+ translate "/bin/upas/aliasmail '&'"
  12. # deliver mail without a domain locally
  13. local!(.*) >> /mail/box/\1/mbox
  14. # your local names
  15. \l!(.*) alias \1
  16. \l\.YOURDOMAIN\.DOM!(.*) alias \1
  17. # convert source domain address to a chain a@b@c@d...
  18. @([^@!,]*):([^!@]*)@([^!]*) alias \2@\3@\1
  19. @([^@!]*),@([^!@,]*):([^!@]*)@([^!]*) alias @\1:\3@\4@\2
  20. # convert a chain a@b@c@d... to ...d!c!b!a
  21. ([^@]+)@([^@]+)@(.+) alias \2!\1@\3
  22. ([^@]+)@([^@]+) alias \2!\1
  23. # queue all mail for delivery
  24. ([^!]*)!(.*) | "/mail/lib/qmail '\s' 'net!\1'" "'\2'"