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" [email protected]
The email shows the literal '\n', not a newline, how do fix it?
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" [email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With