Mail/mailx ignores newline formatting Problem.

I have a file hello.txt which i wish to send as a email body (not attachment).

cat -ev hello.txt
1$
2$
3$

I use the following command to send the hello.txt as the email body.

mailx -s "Alert" myteam@mycomp.com<hello.txt

However, the email received has this in the email body

123

instead of

So, you can see that the newline is not considered in the email body.

hello.txt was created using the below command

echo "1\n">>hello.txt
echo "2\n">>hello.txt
echo "3\n">>hello.txt

i do not find unix2dos , ux2dos , perl or uuencode on my System.

uname -a
Linux mymac 3.10.0-327.36.1.el7.x86_64 #1 SMP Wed Aug 17 03:02:37 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Please suggest a solution.

As was stated repeatedly in your previous thread, cat , mail , mailx , and sendmail do not ignore <newline> characters.

If the people to whom you are sending mail are using mail readers that assumes that all text is HTML, that might be what is changing your <newline>s to <space>s. But I have never seen anything that does what you say is happening.

Unless you have replaced the cat , mail or mailx , and sendmail utilities that were loaded when you installed your BSD, Linux, or UNIX operating system and associated utilities; we all know that none of those utilities is ignoring <newline> characters. Any thread that you start that says otherwise is wasting our time.

4 Likes

I have similar issue, see: