PDA

View Full Version : Imap / cron help!!


timwright
01-06-2010, 09:42 AM
Hi

I've missed the point or a tick box somewhere I'm sure...

When trying to set up the cron job to collect imap mails all I get is a 77 on the page.... guess its a general error message.

If i run from another pc on my network i get
"Unknown remote host [192.168.1.50] or invalid API key"

or on my server i get

"Unknown remote host [::1] or invalid API key [Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.6) Gecko/20091215 Ubuntu/9.10 (karmic) Firefox/3.5.6]"

Should I be using the api key bit? I don't think I need email piping..

All I want to do is have a cron job to collect the emails from google apps accounts rather than the "Enable cron call on staff's activity" because you get a pause every so often while you wait for the fetch.

if i do use the "Enable cron call on staff's activity" it is all working fine with google apps email but I know as soon as this goes live one member of staff is going to moan about the speed!

Could someone please shed a bit of light on this I need to get this up and running asap!!


Thanks.

timwright
01-08-2010, 10:43 AM
anyone??? I'm running ubuntu 9.10 and imap/smtp mail fine but I want to get the cron job working to fetch the emails.

Should I be able to simply run http://localhost/osTicket/api/cron.php in firefox?

Should I have anything about api keys in the cron error considering i'm not piping email?

If it is permissions what permissions? imap, smtp, permisions to cron or permissions to the api folder??

can anyone shed any light for me?

Thanks.

atrizu
01-08-2010, 11:29 AM
I think by default you may not be able to call this through the web. Try running this from the command line:
php -q /path/to/api/cron.php

If that works, I recommend setting up a cronjob for that command.

timwright
01-08-2010, 12:29 PM
Okay all sorted !!!

So i'm now using my Google Apps Imap account with a cron job to collect the emails!!!

As far as I can see you cannot simply run the /api/cron.php in a browser.

What you need to do is enter your account details in the email account setup page.

Then make sure you tick "Enable POP/IMAP email fetch"

Make sure in the general settings that "Enable cron call on staff's activity" is unselected.

Then go to Settings / API and put 127.0.0.1 in the New Ip box
Type three random words in the Phrase box
and then click ADD

Doing that will generate you a hashed code in the top API Key section of the page.

COPY THAT HASH!!!!!

Okay all good so far!!

Now I'm using Ubuntu 9.10 and have already installed webmin to manage it.

So in webmin I go to Scheduled Cron Jobs create a new one with the settings

execute job as = nobody
make it active

Then thanks to the post http://osticket.com/forums/showthread.php?t=3158
Add the command as

wget -q -O /dev/null --user-agent=RE4A05834506BAA1AAC51C748058294C http://localhost/osTicket/api/cron.php

REPLACING your path to cron.php and the RE4A05834506BAA1AAC51C748058294C with you hash that you just copied in the API KEY section.

Then set the times you want it to run at and then SAVE it

Thats it, Job Done!

utinajero
01-13-2012, 07:47 PM
This did the trick for me.

ntozier
01-17-2012, 11:21 AM
As far as I can see you cannot simply run the /api/cron.php in a browser.

This is correct. I believe that it was deemed a security issue to be able to do so.