diff --git a/app/mailers/emails/pipelines.rb b/app/mailers/emails/pipelines.rb
index 48bfc974768b80791c961a7c4c2b09a662641419..7c181d2e3664cbd253fee3d8c26800d80517d56c 100644
--- a/app/mailers/emails/pipelines.rb
+++ b/app/mailers/emails/pipelines.rb
@@ -11,28 +11,27 @@ module Emails
     private
 
     def pipeline_mail(params, to, status)
-      @params = params
+      @project = params.project
+      @pipeline = params.pipeline
       add_headers
 
       mail(to: to, subject: pipeline_subject(status))
     end
 
     def add_headers
-      @project = @params.project # `add_project_headers` needs this
       add_project_headers
-      add_pipeline_headers(@params.pipeline)
+      add_pipeline_headers
     end
 
-    def add_pipeline_headers(pipeline)
-      headers['X-GitLab-Pipeline-Id'] = pipeline.id
-      headers['X-GitLab-Pipeline-Ref'] = pipeline.ref
-      headers['X-GitLab-Pipeline-Status'] = pipeline.status
+    def add_pipeline_headers
+      headers['X-GitLab-Pipeline-Id'] = @pipeline.id
+      headers['X-GitLab-Pipeline-Ref'] = @pipeline.ref
+      headers['X-GitLab-Pipeline-Status'] = @pipeline.status
     end
 
     def pipeline_subject(status)
       subject(
-        "Pipeline #{status} for #{@params.project.name}",
-        @params.pipeline.short_sha)
+        "Pipeline #{status} for #{@project.name}", @pipeline.short_sha)
     end
   end
 end
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 096b3b801af1f5fbec964f70438e32a3a8fe00a5..755edadb7a4e545f472b0e0fc2fffa80e40d5b7b 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -133,8 +133,11 @@ module Ci
     end
 
     def trace_with_state(state = nil)
-      trace_with_state = Ci::Ansi2html::convert(trace, state) if trace.present?
-      trace_with_state || {}
+      if trace.present?
+        Ci::Ansi2html.convert(trace, state)
+      else
+        {}
+      end
     end
 
     def timeout
diff --git a/app/models/service.rb b/app/models/service.rb
index 09b4717a523e63456bcfc26a5444d1e78e37020c..668c3fb69e39d467f0bc072c51a37175bab7c42c 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -198,6 +198,7 @@ class Service < ActiveRecord::Base
       bamboo
       buildkite
       builds_email
+      pipelines_email
       bugzilla
       campfire
       custom_issue_tracker
diff --git a/app/views/notify/pipeline_failed_email.html.haml b/app/views/notify/pipeline_failed_email.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..8d68b9e8483808b0acdd106a136797554542cdaa
--- /dev/null
+++ b/app/views/notify/pipeline_failed_email.html.haml
@@ -0,0 +1,44 @@
+.p
+  Project:
+  = @project.path_with_namespace
+.p
+  Branch:
+  = @pipeline.ref
+.p
+  Commit:
+  = @pipeline.short_sha
+  (
+  = @pipeline.sha
+  )
+.p
+  Commit Message:
+  = @pipeline.git_commit_message
+.p
+  Commit Author:
+  = @pipeline.git_author_name
+.p
+  Pusher:
+  = @pipeline.user.try(:name)
+- failed = @pipeline.statuses.latest.failed
+.p
+  Pipeline #
+  = @pipeline.id
+  had
+  = failed.size
+  failed
+  = 'job'.plural(failed.size)
+  .
+
+- failed.each do |job|
+  .p
+    ID:
+    = job.id
+  .p
+    Stage:
+    = job.stage
+  .p
+    Name:
+    = job.name
+  .p
+    Trace:
+    = job.trace_with_state[:html].html_safe
diff --git a/app/views/notify/pipeline_failed_email.text.erb b/app/views/notify/pipeline_failed_email.text.erb
new file mode 100644
index 0000000000000000000000000000000000000000..9808213af995eaf4560349c51c96024339b6cbe5
--- /dev/null
+++ b/app/views/notify/pipeline_failed_email.text.erb
@@ -0,0 +1,15 @@
+Project: <%= @project.path_with_namespace %>
+Branch: <%= @pipeline.ref %>
+Commit: <%= @pipeline.short_sha %> (<%= @pipeline.sha %>)
+Commit Message: <%= @pipeline.git_commit_message %>
+Commit Author: <%= @pipeline.git_author_name %>
+Pusher: <%= @pipeline.user.try(:name) %>
+<% failed = @pipeline.statuses.latest.failed %>
+Pipeline #<%= @pipeline.id %> had <%= failed.size %> failed <%= 'job'.plural(failed.size) %>.
+
+<% failed.each do |job| %>
+ID: <%= job.id %>
+Stage: <%= job.stage %>
+Name: <%= job.name %>
+Trace: <%= job.trace_with_state[:html] %>
+<% end %>
diff --git a/app/views/notify/pipeline_succeeded_email.html.haml b/app/views/notify/pipeline_succeeded_email.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..64cf7cfe103379618a9fa2b20d9b27ae62fee469
--- /dev/null
+++ b/app/views/notify/pipeline_succeeded_email.html.haml
@@ -0,0 +1,26 @@
+.p
+  Project:
+  = @project.path_with_namespace
+.p
+  Branch:
+  = @pipeline.ref
+.p
+  Commit:
+  = @pipeline.short_sha
+  (
+  = @pipeline.sha
+  )
+.p
+  Commit Message:
+  = @pipeline.git_commit_message
+.p
+  Commit Author:
+  = @pipeline.git_author_name
+.p
+  Pusher:
+  = @pipeline.user.try(:name)
+- failed = @pipeline.statuses.latest.failed
+.p
+  Pipeline #
+  = @pipeline.id
+  had succeeded.
diff --git a/app/views/notify/pipeline_succeeded_email.text.erb b/app/views/notify/pipeline_succeeded_email.text.erb
new file mode 100644
index 0000000000000000000000000000000000000000..6821d1f4459829dbc3bdf09a88b5942dc4511d57
--- /dev/null
+++ b/app/views/notify/pipeline_succeeded_email.text.erb
@@ -0,0 +1,7 @@
+Project: <%= @project.path_with_namespace %>
+Branch: <%= @pipeline.ref %>
+Commit: <%= @pipeline.short_sha %> (<%= @pipeline.sha %>)
+Commit Message: <%= @pipeline.git_commit_message %>
+Commit Author: <%= @pipeline.git_author_name %>
+Pusher: <%= @pipeline.user.try(:name) %>
+Pipeline #<%= @pipeline.id %> had succeeded.