Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run an Exim 4 mail server for friends and clients. We've just given our 8 year old son an email capable device and he uses this server for outbound and inbound email. All outbound email is sent authenticated.

I have a file called /etc/exim4/authenticated.users which contains username:password pairs. I have lines in my configuration like this:

    authenticated = *

    driver = cram_md5
    public_name = CRAM-MD5
    server_secret = ${lookup{$1}lsearch{/etc/exim4/authenticated.users}{$value}fail}
    server_set_id = $1

What I would like is to have a file like this:

/etc/exim4/outgoing.copies littlejohnny:daddy@parent.somewhere

So that when someone authenticates to send an outgoing email as littlejohnny, a copy is sent to daddy@parent.somewhere.

Does anyone know how to achieve this?

share|improve this question
up vote 1 down vote accepted

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:

  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:

  driver = redirect
  data = daddy@parent.somewhere
  condition = ${if eq{$authenticated_id}{littlejohnny}{yes}{no}}

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:

  driver = redirect
  data = ${if exists{/etc/exim4/outgoing.copies}{\

Hopefully that gets you going in the right direction, good luck.

share|improve this answer
Can I use a lookup construct to get this from a file (as I have other parents on the server that may want to do the same thing when I tell them I've done this)? Any chance I could see how to do that? I'm a non-Exim guy, but I'm very impressed :-) – andyjeffries Feb 10 '11 at 8:30
Added an example stanza for a file lookup – jj33 Feb 10 '11 at 13:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.