Bug 12739 - SendAlerts function does not take care of "html" format or UTF-8 Pt. 2

The emails sent via SendAlerts don't take into account HTML format.

_TEST PLAN_

Before applying:

1) Change system preference "AutoEmailOpacUser" to "Send"
2) Change "ACCTDETAILS" notice to HTML and add HTML to it
3) Create a new user with your email address
4) Note how the email displays the HTML tags as plain text

Apply patch

5) Create a new user with your email address
6) Note how the email displays the email as an HTML email

For thoroughness:

7) Change "ACCTDETAILS" notice to non-HTML
8) Create a new user with your email address
9) Note how the email displays the HTML as plain text

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit 54731a0ce1)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
David Cook 2014-12-23 14:13:39 +11:00 committed by Chris Cormack
parent ca55332525
commit 777c2a88de
1 changed files with 6 additions and 8 deletions

View File

@ -430,10 +430,8 @@ sub SendAlerts {
replyto => $branchdetails->{'branchreplyto'},
sender => $branchdetails->{'branchreturnpath'},
subject => Encode::encode( "utf8", "" . $letter->{title} ),
message =>
Encode::encode( "utf8", "" . $letter->{content} ),
contenttype => 'text/plain; charset="utf-8"',
message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ),
contenttype => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"',
}
);
sendmail(%mail) or carp $Mail::Sendmail::error;
@ -518,8 +516,8 @@ sub SendAlerts {
Cc => join( ',', @cc),
From => $userenv->{emailaddress},
Subject => Encode::encode( "utf8", "" . $letter->{title} ),
Message => Encode::encode( "utf8", "" . $letter->{content} ),
'Content-Type' => 'text/plain; charset="utf-8"',
Message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ),
'Content-Type' => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"',
);
$mail{'Reply-to'} = C4::Context->preference('ReplytoDefault')
@ -567,8 +565,8 @@ sub SendAlerts {
replyto => $branchdetails->{'branchreplyto'},
sender => $branchdetails->{'branchreturnpath'},
subject => Encode::encode( "utf8", "" . $letter->{'title'} ),
message => Encode::encode( "utf8", "" . $letter->{'content'} ),
contenttype => 'text/plain; charset="utf-8"'
message => $letter->{'is_html'} ? _wrap_html( Encode::encode( "utf8", $letter->{'content'} ), Encode::encode( "utf8", "" . $letter->{'title'} ) ) : Encode::encode( "utf8", "" . $letter->{'content'} ),
contenttype => $letter->{'is_html'} ? 'text/html; charset="utf-8"' : 'text/plain; charset="utf-8"',
}
);
sendmail(%mail) or carp $Mail::Sendmail::error;