I'm trying to insert "X-Sources" headers into my mailheaders for
debugging purposes. Unforunately documentation about this is very
rare yet on the net.

- use exim-4.34+ or greater
- install exim with embedded perl;
  Debian/Ubuntu users: "apt-get install exim-daemon-heavy"
- insert into main/00_local_macros a line like:
  perl_startup = do '/etc/exim4/mailheaderadd.pl'

Setup a perl script at /etc/exim4/mailheaderadd.pl, which contains:
sub mailheaderadd {
        my $xsource = $ENV{'X-SOURCE'};
        my $xsourceargs = $ENV{'X-SOURCE-ARGS'};
        my $xsourcedir = $ENV{'X-SOURCE-DIR'};

        my $headers = "X-Source: ${xsource}\n"
                    . "X-Source-Args: ${xsourceargs}\n"
                    . "X-Source-Dir: ${xsourcedir}";
        return ($headers);
}

Then use the appropriate transport and insert the add_headers line:

procmail_pipe:
  [...]
  headers_add = "${perl{mailheaderadd}}"

That's all I merged from different sources.

As a result, my script doesn't work. All three environment variables
seem to be empty:

  Date: Wed, 02 Mar 2011 23:52:27 +0100
  X-Source:
  X-Source-Args:
  X-Source-Dir:

What's wrong?

Regards
    -Achim

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to