Re: [gentoo-user] Help with Script that sends out HTML emails[SOLVED-Agn]
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/null1 /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 -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] Help with Script that sends out HTML emails[SOLVED-Agn]
On Tue, 20 Sep 2005, Ow Mun Heng wrote: 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/null1 /usr/sbin/sendmail -t $TEMPFILE rm $TEMPFILE Next, I think the above code can be enhanced by not using a tempfile. perhaps a EOF You could probably use a HERE document. http://www.tldp.org/LDP/abs/html/here-docs.html -- -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] Help with Script that sends out HTML emails[SOLVED-Agn]
On Tue, 2005-09-20 at 01:23 -0400, A. Khattri wrote: On Tue, 20 Sep 2005, Ow Mun Heng wrote: I did it, didn't have to go through perl. Just added a mail_header() to my script. #!/bin/sh # TEMPFILE=/tmp/file.$$ PORTFOLIO_SCRIPT=$HOME/scripts/portfolio.sh $PORTFOLIO_SCRIPT --html $TEMPFILE 2/dev/null1 /usr/sbin/sendmail -t $TEMPFILE rm $TEMPFILE Next, I think the above code can be enhanced by not using a tempfile. perhaps a EOF You could probably use a HERE document. http://www.tldp.org/LDP/abs/html/here-docs.html Not sure what that is. No I-Net access currently. Anyway, on the gentoo box, a simple $PORTFOLIO_SCRIPT --html 2/dev/null1 | /usr/sbin/sendmail -t works. In Fedora, the system which will be sending it out, well, I remember doing just that but it didn't work. Will try again. -- gentoo-user@gentoo.org mailing list