Here's another obscure problem with email, which Im documenting here in case its of use to anybody.
I have a web page at bcra.org.uk which, when accessed, uses a PHP program to generate an email message, which it sends to a Mailing List at list.bcra.org.uk. It works fine when accessed via a browser but fails when run as a scheduled task via CRON. The only difference, I can see, is that when accessed via a browser, the user is the Unix value 'unknown', whereas when run as CRON job the user is BCRA. The specific problem is that Mailman refuses to accept the email. Its sits on the server until delivery times out and then it is returned to Sender. The email log shows the delivery attempt as failed, with e message
Child process of mailman_virtual_transport transport returned 1 from command: /usr/local/cpanel/3rdparty/mailman/mail/mailman
A work-around appears to be to send the mail off-site (I use my Gradwell mail forwarding) and then, from there, route it back to the Mailman list on the BCRA site.
What is happening here? Any ideas anyone?
Problems with local routing of email
- David Gibson
- DG test
- Posts: 604
- Joined: Thu 16 Mar 2006 23:45
Problems with local routing of email
this is my signature
-
- Site Admin
- Posts: 303
- Joined: Thu 29 Dec 2005 23:22
- Location: Axbridge, Somerset, UK
Re: Problems with local routing of email
Can't immediately see why that shouldn't work
BUT your cron command to launch your php script looks decidedly odd (essentially '> php /home/[path]/test5.html')
Does php process html code well?
I think you should try using curl which will allow you to 'execute' a web page from the shell.
Eg:
> curl http://[path]/test5.html > output.txt
or to silence the output:
> curl -s http://[path]/test5.html
See cookies.curl.eg.sh in your bcra/cron directory.
BUT your cron command to launch your php script looks decidedly odd (essentially '> php /home/[path]/test5.html')
Does php process html code well?
I think you should try using curl which will allow you to 'execute' a web page from the shell.
Eg:
> curl http://[path]/test5.html > output.txt
or to silence the output:
> curl -s http://[path]/test5.html
See cookies.curl.eg.sh in your bcra/cron directory.
Last edited by David Gibson on Sun 14 Jul 2013 12:25, edited 2 times in total.
Reason: removed confidential file path information
Reason: removed confidential file path information
Dave Cooke
BCA IT Working Party, BCA Web Services, National Cave Registry Co-ordinator, CSCC Webmaster
BCA IT Working Party, BCA Web Services, National Cave Registry Co-ordinator, CSCC Webmaster
- David Gibson
- DG test
- Posts: 604
- Joined: Thu 16 Mar 2006 23:45
Re: Problems with local routing of email
Seems to work OK. I think I once read somewhere that the command line "php some-file-to-parse" requires the PHP code to be encapsulated in tags, from which I inferred that it parses the file just like it would a web page, outputting the html; and indeed that seems to be the case.David Cooke wrote:Can't immediately see why that shouldn't work
BUT your cron command to launch your php script looks decidedly odd (essentially 'php [path]/test5.html')
Does php process html code well?
That sounds more sensible. I will try it, and I will add "curl" to my small repertoire of commands.David Cooke wrote:I think you should try using curl which will allow you to 'execute' a web page from the shell.
![Smile :-)](./images/smilies/icon_smile.gif)
this is my signature
- David Gibson
- DG test
- Posts: 604
- Joined: Thu 16 Mar 2006 23:45
Re: Problems with local routing of email
OK. CURL seems to be working. Thanks! I guess the salient point may well be that it is executing as "nobody" , (and presumably taking into account my .htaccess settings although I dont think that's relevant here). Whereas my PHP command (which is still a valid thing to do, I assert
) is executing as BCRA and is "merely" parsing the file for PHP. The important point for me to note (as I have other CRON jobs running PHP files) is, I think, the File Permissions thing - viz: the difference between running as BCRA and running as NOBODY.
![Smile :-)](./images/smilies/icon_smile.gif)
this is my signature