How To Use Regular Expressions (regex) To Forward Email In Postfix
erics, April 7th, 2015
Create the file /etc/postfix/virtual-regexp. For example, forward all emails with a leading eric and ending with @thewyz.net to a Gmail account:
1 |
/eric.*/@thewyz.net wyzaerd@gmail.com |
Edit the file /etc/postfix/main.cf. Add regexp:/etc/postfix/virtual-regexp to the virtual_alias_maps line. For example:
1 |
virtual_alias_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexp |
Generate the map .db file:
1 |
postmap /etc/postfix/virtual-regexp |
This example requires the files virtual and virtual.db to exist, even if they are […]