Page 1 of 1

IMAP Fetch problem

Posted: Fri Mar 10, 2017 7:30 pm
by hbk08
Hello everybody,

I hope that you can help me with the following problem.
When I want to setup IMAP Fetch and typed in all information needed (tested with multiple email provider), then it is just testing the connection and there is nothing more happen.

When I click on "save settings" then HTTP ERROR 500 appears.

Does someone has any ideas?

Thank you in advance :)

Re: IMAP Fetch problem

Posted: Fri Mar 10, 2017 8:00 pm
by Klemen
The 500 is an error returned by your server, not by HESK.

For example "mod security" could be causing this, your host will need to check and verify that by examining logs.

Here are a few mod security rules known to create problems:

Code: Select all

# Host is an IP address
SecRuleRemoveById 960017

# Error because of "IP whois" URL in settings
SecRuleRemoveById 950120

# Error when saving URLs with many special chars
SecRuleRemoveById 981173

# Error because the HESK spam subject setting contains "Repetitive Non-Word Characters"
SecRuleRemoveById 960024

What happens when you click the "Test connection" in IMAP settings?

Re: IMAP Fetch problem

Posted: Fri Mar 10, 2017 8:19 pm
by hbk08
Hey,

i am hosting a Fedora DIstribution in a VM. So in this case I am the host :D

When I click on test imap, the loading icon is just running around and nothing is happen.
When I change other settings and click on "save settings" it is working without problem. Just IMAP Fetch is causing this problem.

Re: IMAP Fetch problem

Posted: Fri Mar 10, 2017 8:37 pm
by Klemen
Perhaps IMAP port is blocked (IN and/or OUT) on the VM?

Until the test is successful, it won't save and work.

Re: IMAP Fetch problem

Posted: Fri Mar 10, 2017 9:15 pm
by hbk08
I opened the port 993 but it still doesnt work. I tried it today on a phyiscal machine as well and it doesnt work.

Re: IMAP Fetch problem

Posted: Sat Mar 11, 2017 10:04 am
by Klemen
Do you even have the IMAP extension installed/enabled in PHP?
http://php.net/manual/en/book.imap.php

Re: IMAP Fetch problem

Posted: Sat Mar 11, 2017 3:38 pm
by hbk08
IMAP Extension was missing, thank you! But now I get this error:

[CLOSED] IMAP connection broken (server response)

Re: IMAP Fetch problem

Posted: Sat Mar 11, 2017 3:39 pm
by hbk08
I got it! SSL instead of TLS

Re: IMAP Fetch problem

Posted: Sat Mar 11, 2017 5:37 pm
by hbk08
When I send an E-Mail to the adresss of IMAP Fetching, there will be no Ticket created.

Any ideas why?

Re: IMAP Fetch problem

Posted: Sat Mar 11, 2017 6:14 pm
by Klemen
You need to setup a cron job to run the inc/mail/hesk_imap.php script every 5 minutes or so.

When run, the script will login to the IMAP account, fetch emails and process them.

Re: IMAP Fetch problem

Posted: Sun Mar 12, 2017 6:59 pm
by hbk08
I created with the command: crontab -e following line:

1 * * * * /var/www/html/support/inc/mail/hesk_imap.php

after I rebooted the system. But it still doesnt create tickets.

Re: IMAP Fetch problem

Posted: Sun Mar 12, 2017 7:21 pm
by Klemen
What happens if you turn Debug mode ON in Hesk settings then open hesk_imap.php in your browser?

If that works, something is wrong with your cron setup:

1. the hesk_imap.php file isn't executable on your server (try chmod to 755)
2. the path to PHP on your server is not the same as set inside the hesk_imap.php, try

Code: Select all

1 * * * * /usr/bin/php -q /path/to/hesk/inc/mail/hesk_imap.php >/dev/null 2>&1
(make sure you change /usr/bin/php to php on or server)

Also, note that 1 * * * * will make the cron job run only once per hour (at 10:01, 11:01, 12:01, 13:01, ...). For every minute use * * * * * or (recommended for live setup) use */5 * * * * to run it every 5 minutes.

Re: IMAP Fetch problem

Posted: Sun Mar 12, 2017 7:44 pm
by Klemen
P.s.: I just noticed I forgot to publish IMAP fetching instructions in the knowledgebase :oops:

Here is the article: HESK IMAP fetching