我使用 exim 发送邮件。对于 SMTP 认证用户,我已经添加了几个 ACL,并想添加另一个允许后缀别名的 ACL。后缀别名是电子邮件地址,例如“[电子邮件保护]“。
环境如下:
- 用户名(完整电子邮件地址)存储在
$authenticated_id
- 设置的 FROM 地址存储在
$sender_address
- “用户”在“[电子邮件保护]“可以在
${local_part:$authenticated_id}
- 经过身份验证的用户的域名位于
${domain:$authenticated_id}
现在我想要实现如下的 ACL 规则:
# accept if FROM address is a suffix alias of authenticated address
accept
condition = ${if match {$sender_address} {${local_part:$authenticated_id}+{*}@${domain:$authenticated_id}} }
logwrite = AUTH OK - FROM address $sender_address is a suffix alias of authenticated user
不幸的是,ACL 规则似乎不正确。我收到以下错误消息:
failed to expand ACL string "${if match {$sender_address} {${local_part:$authenticated_id}+{*}@${domain:$authenticated_id}} }": curly-bracket problem in conditional yes/no parsing: 'yes' part did not start with '{'
问:上述条件有什么问题?实现这一目标的正确条件是什么样的?
答案1
尝试了几次后,我终于成功了。规则应该是这样的:
# accept if FROM address is a suffix alias of authenticated address
accept
condition = ${if match {$sender_address} {(${local_part:$authenticated_id}\+.*@${domain:$authenticated_id})}}
logwrite = AUTH OK - FROM address $sender_address is a suffix alias of authenticated user