I use Gmail and every so often I have to hack it back in that text/plain email should be rendered in a monospace font. This makes it much easier to skim system-generated reports, &c. The problems with this are that I have to re-hack Gmail every few years when they change their semantics, and I have more "developer" type colleagues who aren't going to hack their gmail to improve the legibility of these emails.

So, I'm wondering if anyone knows an easy command to take a text file and wrap it in HTML and enough MIME stuff to correctly encode the message as ... ideally multipart alternative, with the HTML being the text in a PRE tag.

I mean, if I can even feed MIME output to cron? I'd be content to pipe to an html-mime-email type command ...


If you mean hacking the standard email that cron emits when a job fails, then you cannot to this without modifying cron. You can emit HTML (or even multipart/alternative) from your script if you want, but it won't change the fact that cron will send it as a text/plain body.

I suggest that you wrap your cron jobs in an outer adaptation script that does this job. The outer adaptor always succeeds and emits no output, but internally it collects the output and exit status of its child process and sends its own email when applicable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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