From owner-freebsd-questions@FreeBSD.ORG Sat Jul 14 22:43:38 2007 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A0A0916A404 for ; Sat, 14 Jul 2007 22:43:38 +0000 (UTC) (envelope-from dan@slightlystrange.org) Received: from catflap.slightlystrange.org (cpc5-cmbg1-0-0-cust497.cmbg.cable.ntl.com [86.6.1.242]) by mx1.freebsd.org (Postfix) with ESMTP id 5D08313C481 for ; Sat, 14 Jul 2007 22:43:38 +0000 (UTC) (envelope-from dan@slightlystrange.org) Received: by catflap.slightlystrange.org (Postfix, from userid 106) id 6BA8861AC; Sat, 14 Jul 2007 23:43:37 +0100 (BST) Received: from stoopid.slightlystrange.org (stoopid.slightlystrange.org [10.1.3.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by catflap.slightlystrange.org (Postfix) with ESMTP id D36156108; Sat, 14 Jul 2007 23:43:36 +0100 (BST) Message-ID: <46995194.8000108@slightlystrange.org> Date: Sat, 14 Jul 2007 23:43:32 +0100 From: Daniel Bye User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Mikhail Teterin References: <200707141603.55899@aldan> <46994B8E.1020108@slightlystrange.org> <200707141827.31177@aldan> In-Reply-To: <200707141827.31177@aldan> Content-Type: text/plain; charset=KOI8-U Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: Can cron e-mail HTML? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2007 22:43:38 -0000 Mikhail Teterin wrote: > = Alter your script to add the 'Content-Type: text/html' header. > > No, I'm afraid, doing this will make the quoted text part of the _body_ of the > message. Ack. Yes, you're quite right. Sorry for the bum advice. > = > Maybe, cron should apply file(1)-like logic to the e-mailed content? > > = No, cron doesn't need any knowledge of how to render email. > > I was not advocating adding such knowledge. My suggestion was to make cron add > proper Content-Type, so that the /recepient's e-mail program/ will render the > message correctly. My scripts generate HTML, someone else could be generating > JPG images (from their web-camera, every morning)... Hmm, an interesting idea. Now I understand what you meant, that is. > = The script itself doesn't have to send the mail - cron will handle that if > = there is any output when it exits, but you /can/ add headers to the message > = as you need. > = > = Just make sure any custom headers come before the empty line delimiter > = between headers and body, and most mail readers should do the right thing. > > The empty line is inserted by cron before any of the job's own output... > > This method will not work, unless the e-mail reader (incorrectly) acts upon > parts of the body as if they were headers... Yep, absolutely right. Got my wrong brain on today! So it's beginning to look as if your best bet is in fact to make your script handle sending the mail, and to only have cron itself mail anything that is the result of an error arising from your script. Not the cleanest solution, but one that will get your messages formatted exactly how you want them. Cheers, Dan