Koozali.org: home of the SME Server

command(s) to mail a file??

Rob Wellesley

command(s) to mail a file??
« on: August 26, 2002, 12:44:00 PM »
Hi

I want to have cron mail a log file to an external address

any ideas?

Curly

Re: command(s) to mail a file??
« Reply #1 on: August 26, 2002, 02:15:50 PM »
cat | mailx -s "subject" user@machine

Rob Wellesley

Re: command(s) to mail a file??
« Reply #2 on: August 26, 2002, 04:36:40 PM »
Curly wrote:
>
> cat | mail -s "subject" user@machine

Thanks, but cat is not what I need here, it would have to go as an attachment when the file is zipped or a binary.

But thanks for your effort

rob

Julie Random

Re: command(s) to mail a file??
« Reply #3 on: August 26, 2002, 05:11:11 PM »
#!/bin/sh
FN=date +%Y%m%d.csv
ftp -n <open host
cd /pub/.....
get $FN
quit
!
mail me@work < $FN


You should be able to modify the above to suit.
Get the shell to build the commands for you.
I've used this to get the shell to download a file and
then mail it to me.

Nathan Fowler

Re: command(s) to mail a file??
« Reply #4 on: August 26, 2002, 07:18:14 PM »
There is a much easier way :)


uuencode local_filename filename_to_use_as_attachment | mail -s "Subject Line" user@domain.com

Thanks,
Nathan