I just submitted a pull request to introduce a new site setting strip incoming email lines . I did not want to completely disable code blocks when this setting is enabled, so code blocks will still be accepted between [code]…[/code] and ```…```, but all the other lines will be stripped (leading and trailing whitespaces will be removed).
For example, the following email:
MIME-Version: 1.0
Date: Tue, 01 Jan 2019 00:00:00 +0300
Subject: An email with whitespaces
From: Foo <foo@discourse.org>
To: bar@discourse.org
Content-Type: text/plain; charset="UTF-8"
Hello
This is a line that will be stripped
This is another line that will be stripped
This is a line that will not be touched.
This is another line that will not be touched.
[code]
1.upto(10).each do |i|
puts i
end
[/code]
This is going to be stripped too.
Bye!
will produce the following reply:
Hello
This is a line that will be stripped
This is another line that will be stripped
This is a line that will not be touched.
This is another line that will not be touched.
1.upto(10).each do |i|
puts i
end
This is going to be stripped too.
Bye!
disabling this setting will create the following reply:
Hello
This is a line that will be stripped
This is another line that will be stripped
This is a line that will not be touched.
This is another line that will not be touched.
1.upto(10).each do |i|
puts i
end
This is going to be stripped too.
Bye!