#949: Replace mail line endings correctly, shorten code.