title: Jenkins Pipeline - emailext Does not Resolve env Variable in Template
body: <p>In my <code>jenkinsfile</code> I defined an environment variable:</p>
  
  <p><code>env.PACKAGES = htmlPackageList</code></p>
  
  <p>I tried accessing it from the template with <code>${PACKAGES}</code> and <code>${env.PACKAGES}</code>, but both times I just receive the email with a plain string.</p>
  
  <p><strong>template.html</strong>:</p>
  
  <pre><code>&lt;pre style='line-height: 10px; color: green; font-size: 20px; white-space: pre; margin: 1em 0; display: block;'&gt;$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS.&lt;br/&gt; &lt;/pre&gt;
  &lt;br/&gt;
  Check console &lt;a href="$BUILD_URL"&gt;Build URL&lt;/a&gt; to view full results.&lt;br/&gt;
  &lt;br/&gt;
  &lt;h4&gt;Change list:&lt;/h4&gt;
  &lt;div style="padding-left: 30px; padding-bottom: 15px;"&gt;
      ${CHANGES, showPaths=true, format="&lt;div&gt;&lt;b&gt;%a&lt;/b&gt;: %r %p &lt;/div&gt;&lt;div style=\"padding-left:30px;\"&gt; &amp;#8212; &amp;#8220;&lt;em&gt;%m&lt;/em&gt;&amp;#8221;&lt;/div&gt;", pathFormat="&lt;/div&gt;&lt;div style=\"padding-left:30px;\"&gt;%p"}
  &lt;/div&gt;
  --&lt;br/&gt;
  
  &lt;h4&gt;Published Packages:&lt;/h4&gt;
  ${PACKAGES}
  </code></pre>
  
  <p>The email is invoked by:</p>
  
  <pre><code>success {
      script{
          emailext body: ('${FILE,path="Jenkins/Templates/template.html"}'),
          to: "${env.EmailTo}",
          subject: '[Jenkins] [$PROJECT_NAME] - [Build # $BUILD_NUMBER] - [$BUILD_STATUS]',
          mimeType: 'text/html'
       }
  }
  </code></pre>