user881480 user881480 - 1 year ago 72
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 Source

Try using echo -e

echo -e "Hello \n World"

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