1

I am using a script that emails me a particular status report. The script sends me the contents of several files. I am using echo to provide a heading in the email that is used to differentiate between parts of the files. I need to make the heading bold and underlined. However, when I do this using tput bold and tput sgr0, or \033[1m the email sends an attachment instead of just populating the body of the email with the data I want. For instance, in the script I have tried placing these variables at the top and wrapping the variables around the text I want bolded:

bold=${tput bold}
normal=${tput sgr0}

echo -e "${bold}Bolded text${normal}"

I have also tried:

echo -e "\033[1mBolded text:\033[0m"

But like I mentioned when I use these methods I get a .bin attachment instead of the data in the body of the email. If I stop trying to bold the headings it works as expected, except my heading does not stand out. I am wondering if this is not compatible when combined with mailx. Is there a way to make this work when emailing? Here is my complete echo command with mailx:

{ echo -e "\n" "\033[1mBolded Text:\033[0m" "\n" "\n"  "More text:"; cat     /script; } | mailx -r "user" -s "email subject " [email protected]
user53029
  • 2,725
  • 8
  • 40
  • 65
  • 2
    You know that email is *plain text*?! There is no bold and underline (except when you start messing with Unicode features). If you want markup you have to resort to HTML mail. – Marco Jan 21 '16 at 17:07
  • No, that did not occur to me. It's linux I thought anythings possible :) I will look into HTML thanks. – user53029 Jan 21 '16 at 17:16

0 Answers0