I'm using Exim with Cpanel.
I created a filter file:
touch /usr/local/cpanel/etc/exim/sysfilter/options/forward_filter
with the following content:
# Exim filter
if ("$sender_address" does not contain "@example.com") then
headers remove From
headers remove Sender
headers remove Return-Path
headers remove Return-path
headers remove Envelope-From
headers remove X-Authenticated-Sender
headers remove Received
headers add "Envelope-From: ${local_part}@$domain"
headers add "X-Authenticated-Sender: ${local_part}@$domain"
headers add "Reply-To: ${sender_address}"
headers add "X-Original-Sender-Address: ${local_part}@$domain"
headers add "From: ${local_part}@$domain"
headers add "Return-Path: ${local_part}@$domain"
headers add "Return-path: ${local_part}@$domain"
headers add "X-Authenticated-Sender: ${local_part}@$domain"
headers add "X-Authenticated-Sender: ${local_part}@$domain"
endif
I receive emails with these headers:
Envelope-From: @
X-Authenticated-Sender: @
Reply-To: email@example.com
X-Original-Sender-Address: @
From: @:
Return-Path: @
Return-path: @
X-Authenticated-Sender: @
X-Authenticated-Sender: @
Desired headers:
Envelope-From: email@mydomain.com
X-Authenticated-Sender: email@mydomain.com
Reply-To: email@example.com
X-Original-Sender-Address: email@mydomain.com
From: email@mydomain.com
Return-Path: email@mydomain.com
Return-path: email@mydomain.com
X-Authenticated-Sender: email@mydomain.com
X-Authenticated-Sender: email@mydomain.com
I tried $local_part@$domain
but it didn't work.
How to read the values of these variables in the filter file?