diff --git a/src/notification/email/mode/alert.pm b/src/notification/email/mode/alert.pm
index 20bea8f74..b57829a94 100644
--- a/src/notification/email/mode/alert.pm
+++ b/src/notification/email/mode/alert.pm
@@ -598,7 +598,7 @@ sub service_message {
my $line_break = '
';
- $self->{option_results}->{service_longoutput} =~ s/\n/
/g;
+ $self->{option_results}->{service_longoutput} =~ s/\\n/
/g;
$self->{payload_attachment}->{subject} = '*** ' . $self->{option_results}->{type} . ' : ' . $self->{option_results}->{service_description} . ' '. $self->{option_results}->{service_state} . ' on ' . $self->{option_results}->{host_name} . ' ***';
$self->{payload_attachment}->{alt_message} = '
@@ -954,6 +954,22 @@ sub run {
);
}
+ my $html_part = Email::MIME->create(
+ attributes => {
+ content_type => 'text/html',
+ charset => 'UTF-8'
+ },
+ body => $self->{payload_attachment}->{html_message}
+ );
+
+ my $text_part = Email::MIME->create(
+ attributes => {
+ content_type => 'text/plain',
+ charset => 'UTF-8'
+ },
+ body => $self->{payload_attachment}->{alt_message}
+ );
+
my $email = Email::MIME->create(
header_str => [
From => $self->{option_results}->{from_address},
@@ -962,20 +978,13 @@ sub run {
],
parts => [
Email::MIME->create(
- attributes => {
- content_type => 'text/plain',
- charset => 'UTF-8'
- },
- body => $self->{payload_attachment}->{alt_message}
- ),
- Email::MIME->create(
- attributes => {
- content_type => 'text/html',
- charset => 'UTF-8'
- },
- body => $self->{payload_attachment}->{html_message}
- ),
- $attachement
+ attributes => {
+ content_type => 'multipart/alternative',
+ charset => 'UTF-8',
+ },
+ parts => [$text_part, $html_part],
+ ),
+ $attachement
]
);