LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to send a html file as an file attachment to my mail from crontab? (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-send-a-html-file-as-an-file-attachment-to-my-mail-from-crontab-646672/)

GRD 06-03-2008 10:38 AM

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

sfjoe 06-03-2008 11:21 AM

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.

bunyan 06-03-2008 12:39 PM

Quote:

Originally Posted by sfjoe (Post 3173314)
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 :-)


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