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?
omarfaridConnect With a Mentor Commented:
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

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.