Try using echo -e
echo -e
echo -e "Hello \n World"
You can type man echo from the command line to read more.
man echo
With mailx, if you send the email to an Outlook user, you can add 2 spaces at the beginning of each line.
mailx
{ echo "Hi xxx, would you tell me something" ; echo "thanks!" ; echo "-xxx" } | sed 's/^/ /g' | mailx -s "subject" xxx@domain.com
The accepted answer did not work for me when using the mail command, I had to use
\r
My whole command is
mail -s "SUBJECT" -aFrom:"from@sdf.com "to@sdfd.com" <<< $( echo -e "Line1\rLine2")