production of and scheduling sun unix - solaris - job to move a csv file to a user via email

at the moment cron runs a weekly job which interrogates a db and produces a set of csv files which reside in a folder on the same sun server.

I need to work out the easiest way to set up a job which will transfer these files to an email address preferably.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You may send them to an email by running a crontab job at required time which will send them one by one.

cd /to/my/dir
for file in *.csv
    /usr/bin/cat $file | /usr/bin/mailx -s "text subject" >> /to/my/log/script.log 2>>&1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

If I understand correctly you wish to convert the cron results into an email and which is then sent to the user.

By default cron jobs sends a email to the user account executing the cronjob. If this is not working you can place the following command at the top of the crontab file,

try it and let me know if it works for you.

Hi casemanager,

Sun Solaris crontab does not support MAILTO env. variable.

Do you need to preserve the files as attachments or is it sufficient to have the file content in the email message body, one message per csv file?
if yes, comment #1 would be your accepted answer.
pauldvincentAuthor Commented:
apologies for not getting back sooner - I am on dialysis and am not always up to working. omarfarid's solution works just as I want it to. Thanks casemanager for looking as well, and bummerlord for reinforcing the solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.