Jenkins pipeline does not send emails correctly
<p>recently we started moving out jenkins jobs to Jenkins pipeline and we are running to some problems with email sending.</p>

<p>If I do something like this</p>

<pre><code>node('WCH-Regression') {
    // do the first test
    stage 'Test'
    node {
        try {
            sh 'exit 1'
        } catch(err) {
            echo "Error"
            currentBuild.result = "FAILURE"
        } finally {
                step([$class                  : 'Mailer',
                  notifyEveryUnstableBuild: true,
                  recipients              : "ppolivka@xxx.yyy",
                  sendToIndividuals       : true])
        }
    }
}
</code></pre>

<p>The email is acknowledged in the job log, but never delivered. </p>

<pre><code>[Pipeline] {
[Pipeline] sh
[workspace] Running shell script
+ exit 1
[Pipeline] echo
Error
[Pipeline] step
Sending e-mails to: ppolivka@xxx.yyy
[Pipeline] }
[Pipeline] // node
</code></pre>

<p>If I do the same thing in normal Jenkins job email is delivered. Also test emails from email configuration in 'Manage Jenkins' are delivered.
Do I need to somehow enable emails for pipeline?</p>

<p>We are running
Jenkins: 2.7.2
Pipeline plugin 2.2
Mailer plugin 1.17</p>

<p>I just tried to simply send email via</p>

<pre><code>node {
    mail body: 'test', subject: 'test', to: 'ppolivka@xxx.yyy'
}
</code></pre>

<p>And still nothing was received. My email configuration in jenkins is fine, all other non pipeline jobs are sending emails and test email from the email notification configuration is working. Why would pipeline emails would not be delivered?</p>