| View previous topic :: View next topic |
| Author |
Message |
fintho
Joined: 16 Jul 2010 Posts: 2 Location: Amsterdam
|
Posted: Fri Jul 16, 2010 10:24 am Post subject: php mail from cron results in file dead.letter |
|
|
I have succesfully written a script that uses MAIL.PHP on PHP5.2.11 and sends a mail with attachment to my hotmail account.
Now I am trying to run this same php script from cron. Had to change the paths in my script to absolute paths, but after that everything seems to work correct.
The only thing is that the "$m->Send();" fails. The error message is: "Saved massage /path/to/dead.letter".
Your script runs fine from cron, everything seems te be there in the dead.letter file. I am guessing that php mail() has trouble sending the message. But why would it?
When executed from cron, I noticed that some _SERVER paths don't get set the way they normally do. Maybe there is more that isn't set right. What do I need to check to get php mail() to work from cron?
I guess this is not an xpertmailer issue, but maybe sombebody can point me in the right direction. Maybe you have seen this before.
PHP core settings from phpinfo(cron and web):
sendmail_from no value
sendmail_path /usr/sbin/sendmail -t -i
SMTP localhost
smtp_port 25
Thanks. |
|
| Back to top |
|
 |
fintho
Joined: 16 Jul 2010 Posts: 2 Location: Amsterdam
|
Posted: Fri Jul 16, 2010 3:33 pm Post subject: |
|
|
Haven't solved the problem yet. For some reason it won't work when i execute it via php in cron.
cron: * * * * * php /var/www/...........
As I mentioned before, the script did work when started from a browser. So I tried executing it via wget in cron. I read it is essentialy the same as calling it from a browser.
And this works!
cron: * * * * * wget 'http://www.myweb.com/script/cron.php'
I think I will stick to the wget solution. But if anyone knows why the first solution didn't work (only the mail() function part failed), I am still interested.
Sorry to clutter this forum, if any of this is really obvious. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 14 Aug 2007 Posts: 136
|
Posted: Wed Jul 21, 2010 6:57 pm Post subject: |
|
|
Most of $_SERVER array variable values is set on web enviroment / server, not on local host (line command). _________________
 |
|
| Back to top |
|
 |
|