user881480 user881480 - 19 days ago 6
Linux Question

how to insert new line in the email using linux mail command?

how to insert new line in the email using linux mail command?

echo "Hi xxx, would you tell me something?\\n thanks!\\n -xxx" | mail -s "subject" xxx@gmail.com


The email shows the literal '\n', not a newline, how do fix it?

Answer

Try using echo -e

echo -e "Hello \n World"

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

Comments