How to insert new line in the email using linux mail command? [duplicate] How to insert new line in the email using linux mail command? [duplicate] linux linux

How to insert new line in the email using linux mail command? [duplicate]


Try using echo -e

echo -e "Hello \n World"

You can type man echo from the command line to read more.


With mailx, if you send the email to an Outlook user, you can add 2 spaces at the beginning of each line.

{ 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")