]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12103 new config option for mail newline chars; merged from MOODLE_19_STABLE
authorskodak <skodak>
Mon, 17 Dec 2007 23:44:25 +0000 (23:44 +0000)
committerskodak <skodak>
Mon, 17 Dec 2007 23:44:25 +0000 (23:44 +0000)
admin/settings/server.php
lang/en_utf8/admin.php
lib/moodlelib.php

index 8c2d9ebf7bc4b6e2af4b078a442a4a93c1600ceb..278596a80184f10b5e174de08f9f16188ca28441 100644 (file)
@@ -57,6 +57,8 @@ $options['0'] = get_string('none');
 $options = array_merge($options, $charsets);
 $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
+$options = array('LF'=>'LF', 'CRLF'=>'CRLF');
+$temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
 if (isloggedin()) {
     global $USER;
     $primaryadminemail = $USER->email;
index 68a2b64aeea78880407d68e4cec3b77e5afc42b3..b8206cdf0dade7e96c75c43237a44b09a0ad201f 100644 (file)
@@ -138,6 +138,7 @@ $string['configloginhttps'] = 'Turning this on will make Moodle use a secure htt
 $string['configloglifetime'] = 'This specifies the length of time you want to keep logs about user activity.  Logs that are older than this age are automatically deleted.  It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime.';
 $string['configlongtimenosee'] = 'If students haven\'t logged in for a very long time, then they are automatically unsubscribed from courses.  This parameter specifies that time limit.';
 $string['configlookahead'] = 'Days to Lookahead';
+$string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.';
 $string['configmaxbytes'] = 'This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP settings post_max_size and upload_max_filesize, as well as the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level. If \'Server Limit\' is chosen, the server maxiumum allowed by the server will be used.';
 $string['configmaxeditingtime'] = 'This specifies the amount of time people have to re-edit forum postings, glossary comments etc.  Usually 30 minutes is a good value.';
 $string['configmaxevents'] = 'Events to Lookahead';
@@ -405,6 +406,7 @@ $string['loglifetime'] = 'Keep logs for';
 $string['longtimenosee'] = 'Unsubscribe users from courses after';
 $string['longtimewarning'] = '<b>Please note that this process can take a long time.</b>';
 $string['mail'] = 'Email';
+$string['mailnewline'] = 'Newline characters in mail';
 $string['maintfileopenerror'] = 'Error opening maintenance files!';
 $string['maintinprogress'] = 'Maintenance is in progress...';
 $string['managelang'] = 'Manage';
index bd35af2f3d5bbd10cb30b598c708f9bb021f8751..528b931f66cc5e72b7500ec37d8b2e9e1c0be29a 100644 (file)
@@ -3833,6 +3833,14 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
 
     $mail->CharSet = 'UTF-8';
 
+    // some MTAs may do double conversion of LF if CRLF used, CRLF is required line ending in RFC 822bis
+    // hmm, this is a bit hacky because LE should be private
+    if (isset($CFG->mailnewline) and $CFG->mailnewline == 'CRLF') {
+        $mail->LE = "\r\n";
+    } else {
+        $mail->LE = "\n";
+    }
+
     if ($CFG->smtphosts == 'qmail') {
         $mail->IsQmail();                              // use Qmail system