https://bugs.exim.org/show_bug.cgi?id=2381

            Bug ID: 2381
           Summary: Environment variable string expansion not working when
                    used with headers_add
           Product: Exim
           Version: 4.91
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: String expansion
          Assignee: ni...@exim.org
          Reporter: r...@byu.net
                CC: exim-dev@exim.org

In short, using the following line in my Exim transport does not result in the
string expansion (insertion) of the environment variable:

headers_add = "X-TESTVAR: ${env{TESTVAR}{$value}{The TESTVAR environment
variable was not found}}"

I never get `$value`; I always get "The TESTVAR environment variable was not
found".

All of the following text has been manually anonymized.

-------------

Environment: 

acco...@example.com [~]# cat /etc/redhat-release
CentOS release 6.10 (Final)


Exim version:

acco...@example.com [~]# exim --version
Exim version 4.91 #1 built 11-May-2018 09:49:25
Copyright (c) University of Cambridge, 1995 - 2018
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2018
Berkeley DB: Berkeley DB 4.7.25: (September 12, 2013)
Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning DKIM DNSSEC
Event I18N OCSP PRDR SPF Experimental_SRS
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmjz dbmnz
dnsdb passwd sqlite
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir autoreply lmtp pipe smtp
Malware: f-protd f-prot6d drweb fsecure sophie clamd avast sock cmdline
Configure owner: 0:0
Size of off_t: 8
2019-03-08 19:04:22 cwd=/home/account 2 args: exim --version
Configuration file is /etc/exim.conf

-------------

The relevant transport from my exim.conf:

dovecot_virtual_delivery:
  driver = lmtp
  socket = /var/run/dovecot/lmtp
  batch_max = 200
  rcpt_include_affixes
  delivery_date_add
  envelope_to_add
  return_path_add
  headers_add = "X-TESTVAR: ${env{TESTVAR}{$value}{The TESTVAR environment
variable was not found}}"

-------------

The commands I executed to send the email:

acco...@example.com [~]# export TESTVAR=hello
acco...@example.com [~]# echo $TESTVAR
hello
acco...@example.com [~]# exim -t
to:m...@example.com
Hi there, this email should have a header named "X-TESTVAR" and it should have
a value of "hello".
acco...@example.com [~]# 

-------------

The resulting email:

Return-Path: <acco...@host.example.com>
Delivered-To: m...@example.com
Received: from host.example.com
    by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
    for <m...@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
Return-path: <acco...@host.example.com>
Envelope-to: m...@example.com
Delivery-date: Fri, 08 Mar 2019 19:00:21 -0600
Received: from account by host.example.com with local (Exim 4.91)
    (envelope-from <acco...@host.example.com>)
    id 1h2QLV-0004Mo-Ee
    for m...@example.com; Fri, 08 Mar 2019 19:00:21 -0600
to:m...@example.com
Message-Id: <e1h2qlv-0004mo...@host.example.com>
From: acco...@host.example.com
Date: Fri, 08 Mar 2019 19:00:20 -0600
X-TESTVAR: The TESTVAR environment variable was not found

Hi there, this email should have a header named "X-TESTVAR" and it should have
a value of "hello".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##

Reply via email to