From 04d6a0276dbdf758e1f2a7e8741a0fd58d712e3f Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 25 Mar 2015 17:07:08 -0500 Subject: [PATCH] email: Use \n as the default line ending It seems that most systems handle the newline character alone without a problem; however, some systems cannot handle the standard CRLF line ending at all. --- include/class.mailer.php | 16 ++-------------- include/ost-sampleconfig.php | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/class.mailer.php b/include/class.mailer.php index a81d1f3ea..7dfb867e3 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -326,25 +326,13 @@ class Mailer { $reply_tag = $cfg->getReplySeparator() . '<br/><br/>'; } - // Use Mail_mime default initially - $eol = null; + // Use general failsafe default initially + $eol = "\n"; // MAIL_EOL setting can be defined in `ost-config.php` if (defined('MAIL_EOL') && is_string(MAIL_EOL)) { $eol = MAIL_EOL; } - // The Suhosin patch will muck up the line endings in some - // cases - // - // References: - // https://github.com/osTicket/osTicket-1.8/issues/202 - // http://pear.php.net/bugs/bug.php?id=12032 - // http://us2.php.net/manual/en/function.mail.php#97680 - elseif ((extension_loaded('suhosin') || defined("SUHOSIN_PATCH")) - && !$this->getSMTPInfo() - ) { - $eol = "\n"; - } $mime = new Mail_mime($eol); // If the message is not explicitly declared to be a text message, diff --git a/include/ost-sampleconfig.php b/include/ost-sampleconfig.php index 3fc0e7178..a4624d1e7 100644 --- a/include/ost-sampleconfig.php +++ b/include/ost-sampleconfig.php @@ -71,7 +71,7 @@ define('TABLE_PREFIX','%CONFIG-PREFIX'); # # Mail Options # --------------------------------------------------- -# Option: MAIL_EOL (default: \r\n) +# Option: MAIL_EOL (default: \n) # # Some mail setups do not handle emails with \r\n (CRLF) line endings for # headers and base64 and quoted-response encoded bodies. This is an error @@ -88,7 +88,7 @@ define('TABLE_PREFIX','%CONFIG-PREFIX'); # https://github.com/osTicket/osTicket-1.8/issues/759 # https://github.com/osTicket/osTicket-1.8/issues/1217 -# define(MAIL_EOL, "\n"); +# define(MAIL_EOL, "\r\n"); # # HTTP Server Options -- GitLab