在里面Exim 文档对于在 acl 中使用 sender=verify,变量 $sender_address_data 应该在 RCPT acl 中使用的 verify=sender 选项之后在 acl 中设置:“如果在路由结束时 $address_data 变量中有数据,则其值将在验证结束时放置在 $sender_address_data 中。”
但对我来说它一直是空白的。在什么情况下$sender_address_data才会非空?
例子:
acl_smtp_rcpt:
...
accept
authenticated = *
verify = sender
logwrite = authenticated user '$authenticated_id' sending as '$sender_address' which \
is '$sender_address_data', if error: '$sender_verify_failure'
导致日志消息中的 $sender_address_data 始终为空,并且没有验证错误:
authenticated user 'user1' sending as '[email protected]' which is '', if error: ''
答案1
仅当路由器内设置了 $sender_address 时,Exim4 才会设置 $sender_address_data由编写配置文件的人并且不会被接受路由器末端的其他命令清除;exim 本身永远不会自动设置该值。例如,这会将 $address_data 设置为电子邮件地址的本地部分,并且该值将作为导致路由或验证发生的 acl 中的 $sender_address_data 提供:
acl_check_rcpt:
...
accept
authenticated = *
verify = sender # TRIGGER ROUTER
logwrite = sender is local user '$sender_address_data' # USE HERE
...
begin routers
...
local_user:
driver = accept
domains = +local_domains
check_local_user
transport = LOCAL_DELIVERY
address_data = ${local_part} # SET HERE