I just figured this out myself in exim4 after a lot of reading about exim configuration.
First, you want your app to add the following header:
Return-Path: <[email protected]>
Works with or without brackets. Exim will add brackets in the end either way.
Second, this was the hard part. Exim always wanted to override my Return-Path: address with the unix user who sent it. You can use /etc/email-addresses in Ubuntu to set a static email for the user of your web app, but this still ignores the Return-Path header. Here is how I modified my exim config to respect the Return-Path from the web app:
In the main config area add:
return_path_remove = false
In the appropriate router config (e.g. dnslookup):
dnslookup:
# ...
errors_to = ${if def:h_return-path: {${address:$h_return-path:}} fail}
headers_remove = return-path
no_more
Now exim should copy the Return-Path header address at the envelope-level and delete the original Return-Path header.
I tried lots of other configuration directives and this is the only way that actually worked for me.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…