I have written a bash script and want it to send me an email with a message body that has a multi-line message.
subject="subject1"
I have tried multiple messages
, here are just a couple that I can remember:
message="temporary message"
message="temporary message
next line here"
message=printf '%s\n' "Note that $start and $end use server time. \n $timeelapsed"
message=echo -e . . .
Here are just four of many variations of the mail
command I have tried in combination with the messages
above:
mail -s "$subject" emailadd1@google.com <<< "$message"
mail -s "$subject" emailadd1@google.com <<< $( echo -e "Note that $start and $end use server time. \n the end")
mail -s "$subject" emailadd1@google.com <<< $( echo -e "Note that $start and $end use server time. \n the end")
mail -s "$subject" emailadd1@google.com <<< $( echo -e "Note that $start and $end use server time. \r the end")
None have worked. The result is always a one-line message in the email body.
I have already tried everything in this related post without luck: How to insert new line in the email using linux mail command?
Can someone please write a complete solution for me?