Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

want to send log files from Ubuntu Server via email using sendemail but the when I do all the text in the email is all in one big mess ( one space between words new lines and spacing not brought into email ) .. no neat format ? How do I fix formatting of log files for email ? I have a had a little play with fmt but had no joy.

Any hints would be appreciated :)

Thank you

share|improve this question
up vote 0 down vote accepted

I don't know logwatch and I'm gonna just flat out guess it's better than what I use..

I use "mail", a command-line program, I believe you get it from the package "mailutils". Through that, I have a series of batch scripts that are called as cron jobs.. And those batch scripts will email me using that program. It's basic in features, but it works and is simple to use..

Still, I don't know about logwatch, I suggest you check that out first, unless you need something really basic, then, maybe, "mail" is what suits your needs best. Cheers!

share|improve this answer

Considered using logwatch? I've not noticed any of the formatting problems you describe. As a side effect, you can customize filters in logwatch to only email you unusual log entries, and ignore normal ones.

share|improve this answer
Thanks - i'll take a look at logwatch... Sounds very useful. What im aqm doing is I have a cron job running a shell script to tar.gz files to a NAS and then I want to send a log file of what has happened I may decided to make a weekly table of results to send or something later but for now I want to figure out why the formatting is all bad ? – user85644 Jun 24 '11 at 21:52
With respect to your weird formatting issue - maybe you need to manually declare what character encoding your input you're mailing uses...? – Doc Jun 24 '11 at 21:59
Thanks I it was my fault. – user85644 Jun 24 '11 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.