-3

I want to run a php script every morning, the script would send an email.

But the email I get from cron always contains an error message.

Can somebody please help?

JasonMichael
  • 2,463
  • 4
  • 26
  • 25
Arnold
  • 17
  • 1
  • 3
  • 1
    Well, what is the error message? – Tatu Ulmanen Feb 01 '10 at 16:56
  • 2
    What kind of server are you on? Please post some more detailed info, otherwise people will have to write book-long answers covering every possible server platform, just to discover that you're on a shared host and can't do it at all. – Pekka Feb 01 '10 at 16:57
  • 1
    @Arnold, I rolled your question back to its original form. Don't be pissed off, SO is a very friendly community overall. Just provide some more detail to your question and I'm sure it will be answered. Oh and welcome to SO :) – Pekka Feb 01 '10 at 17:15

2 Answers2

12

Yes. I'm sure someone here can.

Alex M
  • 2,458
  • 20
  • 15
2

Post your script, crontab line and error. You might want to try piping your script output to sendmail instead of sending mail through PHP.

goharma
  • 39
  • 2
  • Why was this downvoted? It's the only constructive reply. +1 to even it out. – Pekka Feb 01 '10 at 17:20
  • Thanks Pekka. Here's a sample from the web: */10 * * * * /bin/execute/this/script.sh 2>&1 | mail -s "Cronjob ouput" yourname@yourdomain.com – goharma Feb 01 '10 at 19:21
  • TFM for crontab says that if you modify the MAILTO variable you will get output to a different address, obviating the need to invoke /bin/mail. Considering that he's getting an error, I'm going to go out on a limb and say that $PATH needs to be corrected. Again, this is noted in TFM. – Alex M Feb 01 '10 at 20:00