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 firstname.lastname@example.org
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!
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` email@example.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.
|All times are GMT -5. The time now is 08:43 PM.|