[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Help with Script that sends out HTML emails [SOLVED-Agn]



On Mon, 2005-09-19 at 10:52 +0800, Ow Mun Heng wrote:
> On Sun, 2005-09-18 at 22:44 -0400, Sam Varshavchik wrote:
> > >> > >         I'm writing a bash script that basically checks for stocks
> > >> > > prices and I
> > >> > > want the formatted output to be mailed to me. I've got the script
> 
> > >> mail -a "Content-Type: text/html"
> > > 
> > > Okay.. for some reason, FC3's version of mailx (8.1.33) does not have
> > > the "-a" option to mail.

> > You can format the entire mail message yourself, and pipe it to sendmail.  
> > 
> > Consider this as an opportunity for you to learn about proper E-mail 
> > formats.
> 
> Believe it or not, I've actually done this before, but using mail -a
> would have been a simpler matter comparatively. :-(


Done..

I added a mail_header to my script that does..
mail_header()
{
        echo "MIME-Version:1.0"
        echo "From:No-Reply no-reply com"
        echo "To:$RECIPIENT"
        echo "Subject:Quotes $DATE"
        echo "Content-Type: text/html"
        echo
}

and then I added a script for cron 
#!/bin/sh
#
TEMPFILE="/tmp/file.$$"
PORTFOLIO_SCRIPT=$HOME/scripts/portfolio.sh

$PORTFOLIO_SCRIPT --html > $TEMPFILE 2>/dev/null>&1
&& /usr/sbin/sendmail -t < $TEMPFILE && rm $TEMPFILE

Next, I think the above code can be enhanced by not using a tempfile.
perhaps a < EOF 



-- 
Ow Mun Heng
Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM
98% Microsoft(tm) Free!! 
Neuromancer 09:43:41 up 1 day, 1 min, 6 users, load average: 2.44, 2.13,
2.20 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]