In your authenticator, you should have a line like server_set_id =
. Whatever is on the right hand side of that line will be stored in a variable $authenticated_id
. That variable can then be used in your routers to conditionally copy messages sent by your son's authenticated username.
It looks to me like you are using Debian, or a Debian derivative like Ubuntu. Please be aware that Debian packages the Exim configuration file in a way that is specific to their distribution. Because of this, it can be confusing to receive advice for generic exim systems and try to apply it to a Debian system. That said, if you really want it to work and you read the debian docs on how their packaging system works, you can make it work.
In case it's not obvious, I'm a non-Debian-Exim guy, so my advice is generic, you'll have to translate it to Debian's packaging standards.
First, you need to find the authenticators and make sure that they are using the server_set_id
option. Here is an example authenticator:
auth_plain:
driver = plaintext
public_name = PLAIN
server_condition = ${if eq {$3}{AUTH_STR}{yes}{no}}
server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
server_set_id = $auth2
Because of the vagaries of the different auth types, sometimes $auth1
will hold the username, sometimes it will be $auth2
. If your system hasn't been updated for a while, you might also see $1
and $2
, which were used before the auth-specific variables were added.
Now that you have the authenticated user's username being saved into $authenticated_id
, you need to add a router that sends a copy of the mail to your address only if $authenticated_id
matches your son's username. Because the order of routers matter, you'll want to add it pretty high in your routers to make sure you get everything, but you'll have to eyeball your own config to judge where exactly to put it.
Here's an example router that does what you want:
copy_jrs_mail:
driver = redirect
data = [email protected]
condition = ${if eq{$authenticated_id}{littlejohnny}{yes}{no}}
unseen
To do the same thing but look up the information from a file, you can actually drop the condition (because $authenticated_id
being in the file will serve the same purpose) and change the data =
portion to use a file:
copy_auth_mail:
driver = redirect
data = ${if exists{/etc/exim4/outgoing.copies}{\
${lookup{${lc:$authenticated_id}}lsearch{/etc/exim4/outgoing.copies}}}}
unseen
Hopefully that gets you going in the right direction, good luck.