How can I send nicely formatted emails from the command line?

0
6
Asked By TechyBob123 On

I'm trying to send an email from my machine that includes a small table (2 rows and 4 columns). I'm currently using the command 'column -t file.txt | sendmail', but the formatting gets messed up in the email I receive. I heard that mailx might help, and I tried sending HTML files, but I just end up with the raw HTML in the email. Can someone help me out here?

3 Answers

Answered By TabMaster On

Make sure your table looks correct on your sending computer. If you’re using hard tabs for formatting, different email clients might interpret them differently. Switching to soft tabs (using spaces) can help maintain consistent formatting.

Answered By TextWhiz On

Instead of using HTML, it might be better to create a clean text file using a good text editor. Stick to plain text for emails; terminals generally display them in a monospaced font which helps with tabular data.

Answered By FormattingGuru78 On

It sounds like you might need to adjust the email headers to let the recipient know it's HTML content. If you just send HTML without specifying the content type, it appears as plain text. Try modifying the headers accordingly when using mailx.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.