XPertMailer Home Page
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

php mail from cron results in file dead.letter

 
Post new topic   Reply to topic    XPertMailer Forum Index -> Help
View previous topic :: View next topic  
Author Message
fintho



Joined: 16 Jul 2010
Posts: 2
Location: Amsterdam

PostPosted: Fri Jul 16, 2010 10:24 am    Post subject: php mail from cron results in file dead.letter Reply with quote

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
View user's profile Send private message Visit poster's website
fintho



Joined: 16 Jul 2010
Posts: 2
Location: Amsterdam

PostPosted: Fri Jul 16, 2010 3:33 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
admin
Site Admin


Joined: 14 Aug 2007
Posts: 136

PostPosted: Wed Jul 21, 2010 6:57 pm    Post subject: Reply with quote

Most of $_SERVER array variable values is set on web enviroment / server, not on local host (line command).
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    XPertMailer Forum Index -> Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group