From 36652801f98aacde4e6893a75a7ddeb9c6741782 Mon Sep 17 00:00:00 2001 From: "Philippe M. Chiasson" Date: Wed, 18 Nov 2015 20:08:23 +0000 Subject: Bug 1225844 - remove the CRLF Email::MIME workaround when >= 1.911 is installed --- Bugzilla/Mailer.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 556500b1a..68718eb6e 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -56,6 +56,7 @@ BEGIN { } use Email::Send; use Sys::Hostname; +use Bugzilla::Install::Util qw(vers_cmp); sub MessageToMTA { my ($msg, $send_now) = (@_); @@ -75,12 +76,15 @@ sub MessageToMTA { } else { # RFC 2822 requires us to have CRLF for our line endings and - # Email::MIME doesn't do this for us. We use \015 (CR) and \012 (LF) + # Email::MIME doesn't do this for us until 1.911. We use \015 (CR) and \012 (LF) # directly because Perl translates "\n" depending on what platform # you're running on. See http://perldoc.perl.org/perlport.html#Newlines # We check for multiple CRs because of this Template-Toolkit bug: # https://rt.cpan.org/Ticket/Display.html?id=43345 - $msg =~ s/(?:\015+)?\012/\015\012/msg; + if (vers_cmp($Email::MIME::VERSION, 1.911) == -1) { + $msg =~ s/(?:\015+)?\012/\015\012/msg; + } + $email = new Email::MIME($msg); } -- cgit v1.2.3-24-g4f1b