Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-30-2008, 03:02 PM   #1
LQ Newbie
Registered: May 2008
Posts: 2

Rep: Reputation: 0
How to send a html file from crontab?

I have set one of my cronjob to find big files everyday. I have formatted the output of my cronjob as html log file. I need to forward the output html file to my mail

If I use the following syntax

0 8 * * 1-5 /template.html | mail

I get the output with all html tags. I want to see it as a html page without the tags.
Sorry my prev question was not clear
Could someone help me?

Last edited by GRD; 06-02-2008 at 08:50 AM. Reason: Question not clear
Old 05-30-2008, 03:51 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
the html way? what's that mean? a text file is just text, you'd need to somehow rewrite it yourself if you want html.
Old 05-30-2008, 06:32 PM   #3
Registered: Nov 2006
Location: Melbourne Australia
Distribution: Centos, RHEL, Debian, Ubuntu, Mint
Posts: 128

Rep: Reputation: 16
Well, an html file is just text.. to be fair. If I am reading it correctly, you will need to set the right headers in your message.

A few seconds with google gave me this:
echo "From:"
echo "To:"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed;"
echo ' boundary="PAA08673.1018277622/"'
echo "Subject: Test Message"
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--PAA08673.1018277622/"
echo "Content-Type: text/html"
echo ""
echo "<HTML>
<BODY bgcolor=gray>
<blockquote><font color=red>Test</font> <font color=white>Message</font> <font color=blue>Body</font></blockquote>
echo "--PAA08673.1018277622/"
) | sendmail -t
PS: The PAA08673.1018277622 part, is just a random string in this message, something unique to form a boundary. Save that as a script, and call it from cron.

Last edited by grizly; 05-30-2008 at 06:33 PM.
Old 06-04-2008, 03:18 AM   #4
Registered: Jun 2006
Location: Johannesburg, South Africa
Distribution: Ubuntu, CentOS, Debian
Posts: 47

Rep: Reputation: 15
Also check out Nail, a replacement for mailx which I use as it has a lot more features.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script run by crontab won't send email Braynid Linux - Newbie 1 12-21-2007 12:16 AM
How to send an HTML email mjremijan Linux - General 3 03-28-2007 11:57 AM
send my html in outlook icepig General 4 07-15-2004 10:00 AM
Does anyone know how to send a HTML emial. patpawlowski Programming 6 03-03-2004 08:17 AM
Konqueror + file:/usr/share/doc/HTML/index.html jon_k Linux - Software 2 11-25-2003 05:06 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration