LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-03-2008, 10:38 AM   #1
GRD
LQ Newbie
 
Registered: May 2008
Posts: 2

Rep: Reputation: 0
How to send a html file as an file attachment to my mail from crontab?


I had written a perl script which finds files larger than some XXX MB in a directory. It gives output on the details of the all the files . The output of the script had been formatted with html tags and given to a log.html file. I have made this script to run periodically in crontab. Now I need to forward the output html file to my mail

If I use the following syntax

00 7 * * * test.pl | mail me@example.com

I get the output with all html tags. I want to see the output html file as an html file attachment in my mail or html page without the tags.

Could someone help me?

Thanks in advance!
GRD
 
Old 06-03-2008, 11:21 AM   #2
sfjoe
Member
 
Registered: Jun 2007
Location: San Francisco
Distribution: Centos 4, Debian
Posts: 55

Rep: Reputation: 16
mutt

I don't think mail has the attachment feature. You'll need another client like Mutt to do the job. In mutt, the `-a` switch adds an attachment. I think you could do
mutt -a `test.pl` me@mydomain.com
Give that a try.

If that doesn't work, another solution would be to write your output to the tmp directory and then attach it. You can do that in a cron script by separating the commands with a semi-colon.
 
Old 06-03-2008, 12:39 PM   #3
bunyan
Member
 
Registered: Oct 2004
Distribution: RedHat 9 Shrike
Posts: 40

Rep: Reputation: 15
Quote:
Originally Posted by sfjoe View Post
I don't think mail has the attachment feature. You'll need another client like Mutt to do the job. In mutt, the `-a` switch adds an attachment. I think you could do
mutt -a `test.pl` me@mydomain.com
Give that a try.

If that doesn't work, another solution would be to write your output to the tmp directory and then attach it. You can do that in a cron script by separating the commands with a semi-colon.
Mutt. Wow thats a useful feature. Glad I started coming back on here :-)
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send a html file from crontab? GRD Linux - General 3 06-04-2008 04:18 AM
bash script to send a mail attachment aeby Linux - General 6 05-28-2007 07:13 AM
sending html text message with zip file attachment; Content-Type: multipart/mixed phelpsj Programming 1 06-22-2006 09:50 AM
mail -a would not work to send e-mail attachment saavik Linux - Networking 3 12-18-2003 10:33 AM


All times are GMT -5. The time now is 05:32 PM.

Main Menu
Advertisement
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