'How to use a typesetting content to send mail on Linux?
Solution 1:[1]
Your terminal is using monospace font that has same width of each character including spaces.
To make your email looks same way you need to
- define the content font to use one of the monospace fonts
or
- switch your email client to use the monospace font as default.
Edit
To your example you may just wrap the output into the <div style="font-family: monospace;">...</div> that will force it to be using the monospace and the formatting will looks much better
Possible solution
Is to prepare the output using html div with monospace font family, so the email client will use any kind of monospace that is available in its environment:
echo "<div style='font-family: monospace;'>\n" > monospacemail.txt
echo $REPORT >> monospacemail.txt
echo '</div>' >> monospacemail.txt
cat monospacemail.txt | mail -s "$MAIL_TITLE"' $MAIL_TO
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


![[2]](https://i.stack.imgur.com/MmvND.png)