// IMAP settings for authentication
define('USE_IMAP', true);
define('IMAP_HOST', '{192.168.80.34:143/imap}'); //for parameters check http://php.net/manual/en/function.imap-open.php
define('IMAP_AUTOCREATE_VALID_USER', true); // Set to true to autocreate a valid IMAP user in MailWatch database after sucessful login
// Set Time Zone
Login to mailwatch using imap authentication is unsuccessful
Is there any detailed configuration instructions?
Login to mailwatch using imap authentication is unsuccessful
Re: Login to mailwatch using imap authentication is unsuccessful
Firstly,
What is your imap server software?
Secondly,
Can you use an imap client to authenticate against your imap server?
Have you tested it and does it work?
I like using the thunderbird mail client for testing these things.
Lastly,
did you read the documentation at https://www.php.net/manual/en/function.imap-open.php ?
For what it is worth I tested it on my system where I already have the ldap working. I disabled the ldap, enabled and configured the imap and tested. These are the things i discovered
1/ on my stock system, the php imap module was not installed, so I needed to install it.
2/ I had to add /novalidate-cert to the IMAP_HOST configuration line so the php function wouldn't complain about an invalid cert.
At that point, I was able to authenticate and log in with a normal user (and the user was created automatically), but no messages would show up.
looking at the error log, I can see the following messages:
If I have time later, I'll try debugging more and see if I can figure out why it is not showing me the messages.
Oh, other points
I logged in as "username" and not "user@example.com". The program expects you to login with a valid mail address, but my exchange imap expects only "username". I had to comment out the valid mail address as username check from the code to get this far - soooo that means the further problems I am having not seeing the messages may be specific to my own installation/system.
What is your imap server software?
Secondly,
Can you use an imap client to authenticate against your imap server?
Have you tested it and does it work?
I like using the thunderbird mail client for testing these things.
Lastly,
did you read the documentation at https://www.php.net/manual/en/function.imap-open.php ?
For what it is worth I tested it on my system where I already have the ldap working. I disabled the ldap, enabled and configured the imap and tested. These are the things i discovered
1/ on my stock system, the php imap module was not installed, so I needed to install it.
2/ I had to add /novalidate-cert to the IMAP_HOST configuration line so the php function wouldn't complain about an invalid cert.
At that point, I was able to authenticate and log in with a normal user (and the user was created automatically), but no messages would show up.
looking at the error log, I can see the following messages:
My imap server is *cough* Exchange Server 2007 *cough*. It might be a bit old.17-Jun-2020 15:36:52 Asia/Hong_Kong] PHP Notice: Unknown: Kerberos error: No Kerberos credentials available (default cache: KEYRING:persistent:995) (try running kinit) for [10.10.1.245] (errflg=1) in Unknown on line 0
If I have time later, I'll try debugging more and see if I can figure out why it is not showing me the messages.
Oh, other points
I logged in as "username" and not "user@example.com". The program expects you to login with a valid mail address, but my exchange imap expects only "username". I had to comment out the valid mail address as username check from the code to get this far - soooo that means the further problems I am having not seeing the messages may be specific to my own installation/system.
Re: Login to mailwatch using imap authentication is unsuccessful
My imap software is dovecot, it may be that my imap authentication only uses the account name in front of @, no domain name
Re: Login to mailwatch using imap authentication is unsuccessful
That may well be the case.
If you wish to see for yourself, you can do the following:
1/ make a copy of /var/www/html/mailscanner/functions.php
2/ edit /var/www/html/mailscanner/functions.php
3/ search for "function imap_authenticate"
4/ sprinkle the following lines throughout the function (with different numbers of course) 5/ watch the log file (on my system, the location is here)
6/ now go ahead and log in - find out where the code stops. Refine placement of your error_log statements until you find what you need to know.
If you wish to see for yourself, you can do the following:
1/ make a copy of /var/www/html/mailscanner/functions.php
2/ edit /var/www/html/mailscanner/functions.php
3/ search for "function imap_authenticate"
4/ sprinkle the following lines throughout the function (with different numbers of course)
Code: Select all
error_log("imap --> 1");
Code: Select all
tail -f /var/log/php-fpm/www-error.log
Re: Login to mailwatch using imap authentication is unsuccessful
I want to test this feature but an error 500 is my result when I try to login.
I think the error has to do with php-imap not being installed but I can't find the package to install.
I'm on CentOS Stream 8.
I think the error has to do with php-imap not being installed but I can't find the package to install.
I'm on CentOS Stream 8.
Code: Select all
dnf install php-imap
Last metadata expiration check: 3:14:55 ago on Thu 02 Jun 2022 06:55:57 PM CEST.
No match for argument: php-imap
Error: Unable to find a match: php-imap
Re: Login to mailwatch using imap authentication is unsuccessful
Error 500 means internal server error. That usually means there is some error that prevents the server from generating the properly. You usually see this when you add a coding error to the php page.
Could there be another reason, like missing php module? I don't know for sure, but I guess it is possible.
There should be an error log somewhere that will tell you what the actual error is - usually in the apache error log, but depending on your system and how it is configured, it could be somewhere else.
Did you make any changes to the php code? When was your system last working? Did anything change between the time it was working and you started getting the 500 errors? If you can answer those questions, you should be able to isolate where the problem is.
Could there be another reason, like missing php module? I don't know for sure, but I guess it is possible.
There should be an error log somewhere that will tell you what the actual error is - usually in the apache error log, but depending on your system and how it is configured, it could be somewhere else.
Did you make any changes to the php code? When was your system last working? Did anything change between the time it was working and you started getting the 500 errors? If you can answer those questions, you should be able to isolate where the problem is.