Why is this Exim string expansion for an environment variable not working?Exim and TLS AUTH not working for...

Insult for someone who "doesn't know anything"

Are small insurances worth it?

Why does this boat have a landing pad? (SpaceX's GO Searcher) Any plans for propulsive capsule landings?

Can I frame a new window without adding jack studs?

Do I need a return ticket to Canada if I'm a Japanese National?

Why is there an extra space when I type "ls" on the Desktop?

Is the differential, dp, exact or not?

What is Tony Stark injecting into himself in Iron Man 3?

The (Easy) Road to Code

What can I do if someone tampers with my SSH public key?

Should we avoid writing fiction about historical events without extensive research?

Tabular environment - text vertically positions itself by bottom of tikz picture in adjacent cell

Unidentified signals on FT8 frequencies

How does a sound wave propagate?

What does "rhumatis" mean?

Vector-transposing function

I am the person who abides by rules but breaks the rules . Who am I

Why restrict private health insurance?

Professor forcing me to attend a conference, I can't afford even with 50% funding

Is it appropriate to ask a former professor to order a library book for me through ILL?

Generating a list with duplicate entries

How to make sure I'm assertive enough in contact with subordinates?

“I had a flat in the centre of town, but I didn’t like living there, so …”

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?



Why is this Exim string expansion for an environment variable not working?


Exim and TLS AUTH not working for some clientsexim, variable string expansiondoes email pipe to program cause problems with unicode characters?Exim: Force email auth for users of local domainsExim fakereject control not workingexim variable for domainExim won't sign mail send by PHP through SMTPExim address rewrite is not workingsendmail, exim, or php mail settings to avoid “Sender address rejected: Domain not found” on vpsexim filter not working on long emails













0















The problem



In short, using the following line in my Exim transport does not result in the string expansion (insertion) of the TESTVAR 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".



What am I doing wrong?





Environment:



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


Exim version:



account@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:



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




The resulting email:



Return-Path: <account@host.example.com>
Delivered-To: me@example.com
Received: from host.example.com
by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
for <me@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
Return-path: <account@host.example.com>
Envelope-to: me@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 <account@host.example.com>)
id 1h2QLV-0004Mo-Ee
for me@example.com; Fri, 08 Mar 2019 19:00:21 -0600
to:me@example.com
Message-Id: <E1h2QLV-0004Mo-Ee@host.example.com>
From: account@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".








share



























    0















    The problem



    In short, using the following line in my Exim transport does not result in the string expansion (insertion) of the TESTVAR 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".



    What am I doing wrong?





    Environment:



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


    Exim version:



    account@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:



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




    The resulting email:



    Return-Path: <account@host.example.com>
    Delivered-To: me@example.com
    Received: from host.example.com
    by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
    for <me@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
    Return-path: <account@host.example.com>
    Envelope-to: me@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 <account@host.example.com>)
    id 1h2QLV-0004Mo-Ee
    for me@example.com; Fri, 08 Mar 2019 19:00:21 -0600
    to:me@example.com
    Message-Id: <E1h2QLV-0004Mo-Ee@host.example.com>
    From: account@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".








    share

























      0












      0








      0








      The problem



      In short, using the following line in my Exim transport does not result in the string expansion (insertion) of the TESTVAR 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".



      What am I doing wrong?





      Environment:



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


      Exim version:



      account@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:



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




      The resulting email:



      Return-Path: <account@host.example.com>
      Delivered-To: me@example.com
      Received: from host.example.com
      by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
      for <me@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
      Return-path: <account@host.example.com>
      Envelope-to: me@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 <account@host.example.com>)
      id 1h2QLV-0004Mo-Ee
      for me@example.com; Fri, 08 Mar 2019 19:00:21 -0600
      to:me@example.com
      Message-Id: <E1h2QLV-0004Mo-Ee@host.example.com>
      From: account@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".








      share














      The problem



      In short, using the following line in my Exim transport does not result in the string expansion (insertion) of the TESTVAR 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".



      What am I doing wrong?





      Environment:



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


      Exim version:



      account@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:



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




      The resulting email:



      Return-Path: <account@host.example.com>
      Delivered-To: me@example.com
      Received: from host.example.com
      by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
      for <me@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
      Return-path: <account@host.example.com>
      Envelope-to: me@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 <account@host.example.com>)
      id 1h2QLV-0004Mo-Ee
      for me@example.com; Fri, 08 Mar 2019 19:00:21 -0600
      to:me@example.com
      Message-Id: <E1h2QLV-0004Mo-Ee@host.example.com>
      From: account@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".






      exim





      share












      share










      share



      share










      asked 2 mins ago









      rinogorinogo

      13429




      13429






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You're looking for the keep_environment setting. It specifies which environment variables are trusted and should be allowed to be used within Exim's execution. (Documentation)



          If your exim.conf contains this line:



          keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR


          Change it to this:



          keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR




          share























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "2"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f957454%2fwhy-is-this-exim-string-expansion-for-an-environment-variable-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You're looking for the keep_environment setting. It specifies which environment variables are trusted and should be allowed to be used within Exim's execution. (Documentation)



            If your exim.conf contains this line:



            keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR


            Change it to this:



            keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR




            share




























              0














              You're looking for the keep_environment setting. It specifies which environment variables are trusted and should be allowed to be used within Exim's execution. (Documentation)



              If your exim.conf contains this line:



              keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR


              Change it to this:



              keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR




              share


























                0












                0








                0







                You're looking for the keep_environment setting. It specifies which environment variables are trusted and should be allowed to be used within Exim's execution. (Documentation)



                If your exim.conf contains this line:



                keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR


                Change it to this:



                keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR




                share













                You're looking for the keep_environment setting. It specifies which environment variables are trusted and should be allowed to be used within Exim's execution. (Documentation)



                If your exim.conf contains this line:



                keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR


                Change it to this:



                keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR





                share











                share


                share










                answered 30 secs ago









                rinogorinogo

                13429




                13429






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Server Fault!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f957454%2fwhy-is-this-exim-string-expansion-for-an-environment-variable-not-working%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

                    As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                    Маріан Котлеба Зміст Життєпис | Політичні погляди |...