I am using the following bash script to send an email
#!/bin/bash
recipients="me@web.com, you@web.com"
subject="Just a Test"
from="test@test.com"
message_txt="This is just a test.\n Goodbye!"
/usr/sbin/sendmail "$recipients" << EOF
subject:$subject
from:$from
$message_txt
EOF
But when the email arrives the $message_txt content is printed literally like this :
This is just a test.\n Goodbye!
Instead of interpreting the new line like this :
This is just a test.
Goodbye!
I've tried using :
echo $message_txt
echo -e $message_txt
printf $message_txt
But the result is always the same. Where am I going wrong?
What am I doing wrong?