# How to notify the build result for both success and failure by email?

**URL:** <https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872>\
**Category:** Drone Support\
**Created:** [December 16, 2020, 8:34am UTC](https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872 "2020-12-16T08:34:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndySu1021](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/andysu1021/32/3095_2.png) [@AndySu1021](https://drone.discourse.group/u/AndySu1021)\
**Post date:** [December 16, 2020, 8:34am UTC](https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872/1 "2020-12-16T08:34:35Z")

</div>

I would like to send email notification to user after pipeline build, and I put the notify step as the final step in the pipeline.

I found that if the previos step like installing something got an error, the pipeline will stop execution, so I can’t get an email.

Would it possible to send the notification both success and failure in the pipeline execution?

I use the “drillster/drone-email” image.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 16, 2020, 2:14pm UTC](https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872/2 "2020-12-16T14:14:41Z")

</div>

You can use the `when` clause to specify that a step should run on failure. You can see an example at [https://docs.drone.io/pipeline/docker/syntax/conditions/#by-status](https://docs.drone.io/pipeline/docker/syntax/conditions/#by-status)

---

<div class="post-metadata">

**Author:** ![AndySu1021](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/andysu1021/32/3095_2.png) [@AndySu1021](https://drone.discourse.group/u/AndySu1021)\
**Post date:** [December 16, 2020, 2:54pm UTC](https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872/3 "2020-12-16T14:54:59Z")

</div>

@bradrydzewski Thank so much, I have solve the problem after use when clause.

I found another problem.

When I want to use the {{ build.status }} as the email subject in the “Notify Result” step, I expect that will get the “failure”, bui I get the “success”.

![截圖 2020-12-16 下午10.50.27](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/b/bb7de8e99797c728b8526921d98ac3eed4bd7c40.png)

I’m confused about that.

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [December 16, 2020, 4:03pm UTC](https://drone.discourse.group/t/how-to-notify-the-build-result-for-both-success-and-failure-by-email/10872/4 "2020-12-16T16:03:59Z")

</div>

I recommend contacting the plugin author. They will be able to help you with any questions you have about the plugin. Since I did not create this plugin (and have never used it) it is outside the scope of support that I can provide.

> **[Drillster/drone-email](https://github.com/drillster/drone-email)**
>
> Drone plugin for sending email notifications. Contribute to Drillster/drone-email development by creating an account on GitHub.
