FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Why is "backslash n" replaced in outgoing mail?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Why is "backslash n" replaced in outgoing mail? [message #158993 is a reply to message #158952] Tue, 21 April 2009 12:28 Go to previous messageGo to previous message
tgtaft is currently offline  tgtaft   United States
Messages: 3
Registered: March 2009
Karma:
Junior Member
I think I discovered why the original substitution code was there. Many of the pre-written email notices that the forum sends out (e.g., when a password reset is requested) are defined in, e.g., thm/default/i18n/english/msg, and they use two-character backslash n sequences to define newlines. With my original patch, none of these messages (e.g., reset_reset on line 423 in english/msg) look right when sent.

This new patch restricts the fix to notifications.

--- iemail.inc.t.orig 2009-04-21 08:23:54.000000000 -0400
+++ iemail.inc.t 2009-04-21 08:25:57.000000000 -0400
@@ -45,7 +45,7 @@
return $text;
}

-function send_email($from, $to, $subj, $body, $header='')
+function send_email($from, $to, $subj, $body, $header='', $munge_newlines=1)
{
if (empty($to)) {
return;
@@ -75,7 +75,10 @@
}
$header = "From: ".$from."\nErrors-To: ".$from."\nReturn-Path: ".$from."\nX-Mailer: FUDforum v".$GLOBALS['FORUM_VERSION'].$header;

- $body = str_replace(array('\n',"\r"), array("\n",""), $body);
+ $body = str_replace("\r", "", $body);
+ if ($munge_newlines) {
+ $body = str_replace('\n', "\n", $body);
+ }
$subj = encode_subject($subj);
if (version_compare("4.3.3RC2", phpversion(), ">")) {
$body = str_replace("\n.", "\n..", $body);

--- tmp/imsg_edt.inc.t.orig 2009-04-21 08:15:19.000000000 -0400
+++ tmp/imsg_edt.inc.t 2009-04-21 08:15:25.000000000 -0400
@@ -785,6 +785,6 @@
$subj = $frm_descr." ".$subj;
}

- send_email($GLOBALS['NOTIFY_FROM'], $to, $subj, $body_email, $headers);
+ send_email($GLOBALS['NOTIFY_FROM'], $to, $subj, $body_email, $headers, 0);
}
?>
\ No newline at end of file
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: change ROOT path and time problem
Next Topic: NNTP Errors
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Oct 20 19:45:47 GMT 2024

Total time taken to generate the page: 0.04206 seconds