On Sun, 2005-09-18 at 22:36 -0500, John Jolet wrote:
> On Sunday 18 September 2005 22:11, A. Khattri wrote:
> > On Mon, 19 Sep 2005, Ow Mun Heng wrote:
> > > Be that as it may, I'm not Perl person (picked up the book, but haven't
> > > really progressed anywhere hehe).
> > >
> > > But.. when push comes to shove....
> >
> > Im assuming there is probably a CPAN module that does most of this for you
> > - this is why I think Perl might be a better way to go.
> >
> >
> > --
> there is...MIME::Entity...used thusly (from a perl program I use to email pdf
> files, but you pass the mim-type on the command line, so it can send any mime
> type):
> my $top = MIME::Entity->build(Type => "multipart/mixed",
> From => "[EMAIL PROTECTED]",
> Bcc => $address,
> Subject => "Mills Messenger by
> e-Mail");
>
> $top->attach( Path => $file_to_send,
> Type => $mime_type,
> Encoding => "base64");
>
> my $message = "Attached is your Mills Messenger for this week. Enjoy!";
> $top->attach(Data=>$message);
>
> open MAIL, "|/usr/sbin/sendmail.postfix -t -oi -oem" or die "Error on
> mail
> o
> pen is: $!\n";
> $top->print(\*MAIL);
> close MAIL;
I did it, didn't have to go through perl. Just added a mail_header() to
my script.
mail_header()
{
echo "MIME-Version:1.0"
echo "From:[EMAIL PROTECTED]"
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:46:43 up 1 day, 4 min, 7 users, load average: 2.75, 2.30,
2.24
--
[email protected] mailing list