正则表达式在 postfix 中的多个包罗万象的设置

the*_*kas 9 postfix ubuntu

我需要在 postfix 上设置一个 regex catch-all 函数,这样:

  • tom.(anything)@domain.com转到tom@other.com
  • phil.(anything)@domain.com转到phil@other.com

这如何在 postfix 中实现?

Fli*_*mzy 18

将此添加到您的 main.cf:

alias_maps = regexp:/etc/postfix/aliases
Run Code Online (Sandbox Code Playgroud)

然后创建/etc/postfix/aliases如下:

/^tom\..*@domain.com$/     tom@other.com
/^phil\..*@domain.com$/    phil@other.com
Run Code Online (Sandbox Code Playgroud)

有关其他信息,请参阅正则表达式表文档。

  • 谢谢!将其称为 virtual_alias_maps = regexp:/etc/postfix/aliases 并使其运行。 (3认同)