Mailgun 可以使用正则表达式转发邮件吗?

Can use regular expression to forward mail in Mailgun?

我正在尝试仅使用一种路由将针对一个域的所有邮件转发到不同的域:

过滤器:.*@mail.domain.com

转发:*@domain.com

"Forward" 的语法是我无法开始工作也找不到示例的语法。

您需要使用 named capture groups,请参阅文档:

Explanation- we want Mailgun to receive and forward the incoming message to an external domain, but retain the user to user mapping. To do this, we use a named capture. The named capture will remember the “user” and use it in the forward action.

所以这应该有效:

match_recipient('(?P<user>.*?)@mail.domain.com') -> forward('g<user>@domain.com')