To follow the previous answer using mail :
Often, one html output is interpreted by the client’s mailer, which cannot format things using a fixed-width font. That way, your beautifully formatted ascii alignment gets spoiled. To send an old-fashioned fixed width like God did, try the following:
{ echo -e "<pre>" echo "Descriptive text here." shell_command_1_here another_shell_command cat <<EOF This is the ending text. </pre><br> </div> EOF } | mail -s "$(echo -e 'Your subject.\nContent-Type: text/html')" to.address@company.com
You don’t necessarily need “Descriptive text here.”, But I found that sometimes the first line, depending on its contents, can cause the mail program to interpret the rest of the file in a way that you did not. First try a script with simple descriptive text before fine-tuning the output the way you want.
Mike S Nov 18 '14 at 16:26 2014-11-18 16:26
source share