<p>If you're using Jenkins pipeline, you can use the <a href="https://jenkins.io/doc/pipeline/tour/post/#email" rel="nofollow noreferrer">email notification post action</a>, as a way to <em>send</em> the message:</p>

<pre><code>post {
    failure {
        mail to: 'team@example.com',
             subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
             body: "Something is wrong with ${env.BUILD_URL}"
    }
}
</code></pre>

<p>(you would have to configure the server and credentials for your case)</p>

<p>The message itself can be constructed from the job data. The easiest way is perhaps to tee the output of the job to a file and use it as an artifact to attach to the message that gets sent.</p>

CC BY-SA 4.0
2020-01-10T09:21:07.943Z
2020-01-10T09:21:07.943Z
Bruce Becker
<p>I am deploying my software on different OS ( Red hat &amp; suse) and I need to know if my latest version of the software will work. In order to check if the installation works it's enough to check some log files generated by the software.</p>

<p>Now I am trying to integrate some CI/CD tools and I am trying Jenkins now. I have created a pipeline which is triggered by every commit in bitbucket and I need a way to get the log files and the build status from the servers and mail them to the rest of the team.</p>

<jenkins><continuous-integration><jenkins-pipeline>
Mail logs with Jenkins
Safta Daniel
# Mail logs with Jenkins

(Asked by: username_0 on 2020-01-10)

I am deploying my software on different OS ( Red hat & suse) and I need to know if my latest version of the software will work. In order to check if the installation works it's enough to check some log files generated by the software.

Now I am trying to integrate some CI/CD tools and I am trying Jenkins now. I have created a pipeline which is triggered by every commit in bitbucket and I need a way to get the log files and the build status from the servers and mail them to the rest of the team.

**Tags:** jenkins, continuous-integration, jenkins-pipeline


---

## 1 answers

### Answer by username_1 on 2020-01-10. Score: 1

If you're using Jenkins pipeline, you can use the email notification post action, as a way to send the message:
post {
    failure {
        mail to: 'team@example.com',
             subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
             body: "Something is wrong with ${env.BUILD_URL}"
    }
}

(you would have to configure the server and credentials for your case)
The message itself can be constructed from the job data. The easiest way is perhaps to tee the output of the job to a file and use it as an artifact to attach to the message that gets sent.


---

