From 4f9d3ec703e92a351ca034c67d0f2375828f0fb7 Mon Sep 17 00:00:00 2001
From: Matthieu Muffato <muffato@ebi.ac.uk>
Date: Wed, 8 Oct 2014 21:06:21 +0100
Subject: [PATCH] Support HTML emails

---
 modules/Bio/EnsEMBL/Hive/RunnableDB/NotifyByEmail.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Hive/RunnableDB/NotifyByEmail.pm b/modules/Bio/EnsEMBL/Hive/RunnableDB/NotifyByEmail.pm
index b00303b55..688ad7b60 100644
--- a/modules/Bio/EnsEMBL/Hive/RunnableDB/NotifyByEmail.pm
+++ b/modules/Bio/EnsEMBL/Hive/RunnableDB/NotifyByEmail.pm
@@ -52,6 +52,7 @@ use base ('Bio::EnsEMBL::Hive::Process');
 
 sub param_defaults {
     return {
+            'is_html'    => 0,
             'subject' => 'An automatic message from your pipeline',
     };
 }
@@ -78,6 +79,8 @@ sub fetch_input {
 
     param('text'):    Text of the email message. It will undergo parameter substitution.
 
+    param('is_html'): Boolean. Whether the content of 'text' is in HTML
+
     param('*'):       Any other parameters can be freely used for parameter substitution.
 
 =cut
@@ -91,6 +94,7 @@ sub run {
 
     open(SENDMAIL, "|sendmail $email");
     print SENDMAIL "Subject: $subject\n";
+    print SENDMAIL "Content-Type: text/html;\n" if $self->param('is_html');
     print SENDMAIL "\n";
     print SENDMAIL "$text\n";
     close SENDMAIL;
-- 
GitLab