Re: [exim] html mails from cronjob

Top Page

Reply to this message
Author: Dominic Benson
Date:  
To: exim-users
Subject: Re: [exim] html mails from cronjob
On 07/01/11 09:37, Mike Cardwell wrote:
>
> Just had a thought about how you can do this. Pipe the output directly
> to Exim from your cron job:
>
> s m h d m y    yourcommand | exim -i recipient.address

>
> But only if "yourcommand" outputs *all* of the relevant headers, eg
> From, To, Subject etc, as well as the Content-type obviously.
>
>


If you're using BSD mail/mailx (default in Debian), then you can add
headers with -a:

cat test.html | mail -s "Test" -a "Content-type: text/html" user@???

Other versions of mailx treat -a as an option to add an attachment - but
they will auto-add appropriate MIME structure, with some content-guessing:

echo "" | mail -s "Test" -a test.html user@???