[SOLVED] Simple Cron Job - Need Help please I am simply trying to get a cronjob to email my .txt file. That parts easy and works fine The problem: I want to change the From: and Subject: of the email so its says its from me instead of root Heres my very simple Cronjob MAILTO="[email protected]" 30 20 * * * /var/mytextfile.txt Yeh thats all there is to it, it works fine but I just wanna know how to change it so it can do what I mentioned above. Doing this doesnt work: FROM="[email protected]" SUBJECT="My Text File" Yeh Im a newbie at scripts. Im using Debain Lenny by the way Any idea guys?
Ok im getting there slowly, this now gives me the subject i want to have 30 20 * * * /var/mytextfile.txt | mail -s "My Subject" [email protected] So if only I could figure out the From Part Any Geniuses out there know how? This Part really has me stumped. I want to say its from [email protected] instead of root.
Try sending your mail using mailm - it allows you to specify all that stuff. Works great. http://www.sfr-fresh.com/unix/privat/mailm-0.3.tar.gz/
thanks, however mailm isn't working for me, am getting several errors when trying to install, it seems others are having the same problem as me but no solutions can be found. I have just about got this cronjob working now so I would like to stick with it. Anyone else can be of help?? Thanks for helping id10t
Problem Solved. All you need to do is create a different user and set a Password for the user. click on SYSTEM / ADMINISTRATION / USERS AND GROUPS Make the new user have the same username as your email address and setup the Cron under this new user. e.g. [email protected] (Username would be donotreply) Then if the Hostname is your domain name which you want it to be then the email the cronjob sends will look like its from that address [email protected] So simple yet it took me ages to figure it out. I feel like an idiot. Anyway hope this helps anyone else trying to do the same thing with a Cronjob. For newbies wondering how to become that new user, simply open a shell and type this: "su donotreply" (donotreply being the new user you have created of course) Enter Password and then type "crontab -e" and setup the cron as the new user. To easy