From ae404a6265279cfcc61e3669b94d5fe57377c7e2 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 31 Oct 2008 13:22:43 +0000 Subject: Closes #446: * Errant \r\n and \r chars coverted to \n. * newlines stripped from subject headers. * Lines starting with From are changed to >From git-svn-id: https://code.elgg.org/elgg/trunk@2375 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/notification.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engine/lib/notification.php') diff --git a/engine/lib/notification.php b/engine/lib/notification.php index 87f5b962a..8eeb009c0 100644 --- a/engine/lib/notification.php +++ b/engine/lib/notification.php @@ -221,6 +221,9 @@ if ($to->email=="") throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid)); + // Sanitise subject + $subject = preg_replace("/(\r\n|\r|\n)/", " ", $subject); // Strip line endings + // To $to = $to->email; @@ -255,8 +258,10 @@ $subject = mb_encode_mimeheader($subject,"UTF-8", "B"); } - // Strip tags from message - $message = strip_tags($message); + // Format message + $message = strip_tags($message); // Strip tags from message + $message = preg_replace("/(\r\n|\r)/", "\n", $message); // Convert to unix line endings in body + $message = preg_replace("/^From/", ">From", $message); // Change lines starting with From to >From return mail($to, $subject, wordwrap($message), $headers); } -- cgit v1.2.3