LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-30-2008, 03:02 PM   #1
GRD
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 me@example.com

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
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
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
grizly
Member
 
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:
Quote:
(
echo "From: you@your_company.com"
echo "To: you@your_company.com"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed;"
echo ' boundary="PAA08673.1018277622/server.domain.com"'
echo "Subject: Test Message"
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--PAA08673.1018277622/server.domain.com"
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>
</body>
</html>"
echo "--PAA08673.1018277622/server.domain.com"
) | 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
garyalex
Member
 
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.
 
  


Reply


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


All times are GMT -5. The time now is 01:13 AM.

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