afterlogic / webmail-lite

AfterLogic WebMail Lite PHP. Fast and easy-to-use webmail front-end for your existing IMAP mail server, Plesk or cPanel.
https://afterlogic.org/webmail-lite
GNU Affero General Public License v3.0
443 stars 120 forks source link

Adding multiple domain settings #56

Closed abdelrahmanahmed closed 7 years ago

abdelrahmanahmed commented 7 years ago

I have installed webmail successfully and it worked great , but i have a question , i have (gmail,outlook) emails, how do i setup configuration for them? i have done it already but only for gmail or outolook ,not both of them at once.

afterlogic-support commented 7 years ago

WebMail Lite isn't really designed for that, its adminpanel only allows for managing one mailserver settings (under Domains > Default settings). However, it's possible to make WebMail recognize different mail hosts for different email domains. See the plugin at: https://afterlogic.com/docs/plugins-repository/override-default-domain-settings

abdelrahmanahmed commented 7 years ago

i have installed this plugin but unfortunately it didtn't work . my steps : 1- installed override-default-domain-settings plugin

2- my code in this plugin

`            if ($sEmailDomain === 'gmail.com') {
                    $oAccountToCreate->IncomingMailServer = 'imap.gmail.com';
                    $oAccountToCreate->OutgoingMailServer = 'smtp.gmail.com';
                    $oAccountToCreate->IncomingMailPort = 993;
                    $oAccountToCreate->OutgoingMailPort = 465;

                }
                elseif ($sEmailDomain === 'outlook.com') {
                    $oAccountToCreate->IncomingMailServer = 'imap-mail.outlook.com';
                    $oAccountToCreate->OutgoingMailServer = 'smtp-mail.outlook.com';
                    $oAccountToCreate->IncomingMailPort = 993;
                    $oAccountToCreate->OutgoingMailPort = 465;
                }`

3- added this line to config.php 'plugins.override-default-domain-settings' => true, 4- in gmail account i check that less secure app is true . 5-when i tried to login with any gmail or outlook/hotmail it gives me this error Error while connecting to mail server.

afterlogic-support commented 7 years ago

If you check the logs, can you confirm that WebMail is trying to connect to the matching IMAP server for Outlook/Hotmail? That way, you can determine if the plugin actually has its effect and the issue may be elsewhere.

abdelrahmanahmed commented 7 years ago

The plugins works but still the same error


[10:54:28.94][7efad605] IMAP[NOTE]: Start connection to "tcp://imap-mail.outlook.com:993"
[10:54:49.10][7efad605] IMAP[ERROR]: MailSo\Net\Exceptions\SocketReadTimeoutException: MailSo-Net-Exceptions-SocketReadTimeoutException (NetClient.php ~ 490) in /var/www/html/webmail/libraries/MailSo/Net/NetClient.php:490
Stack trace:
#0 /var/www/html/webmail/libraries/MailSo/Imap/ImapClient.php(1915): MailSo\Net\NetClient->getNextBuffer()
#1 /var/www/html/webmail/libraries/MailSo/Imap/ImapClient.php(1781): MailSo\Imap\ImapClient->partialParseResponseBranch(Object(MailSo\Imap\Response))
#2 /var/www/html/webmail/libraries/MailSo/Imap/ImapClient.php(1833): MailSo\Imap\ImapClient->parseResponse('*', true)
#3 /var/www/html/webmail/libraries/MailSo/Imap/ImapClient.php(151): MailSo\Imap\ImapClient->parseResponseWithValidation('*', true)
#4 /var/www/html/webmail/libraries/afterlogic/common/managers/users/manager.php(458): MailSo\Imap\ImapClient->Connect('imap-mail.outlo...', 993, 0)
#5 /var/www/html/webmail/libraries/afterlogic/common/managers/webmail/manager.php(141): CApiUsersManager->createAccount(Object(CAccount), true)
#6 /var/www/html/webmail/libraries/afterlogic/common/managers/integrator/manager.php(823): CApiWebmailManager->createAccount('abdelrahman.wah...', '', '', Array)
#7 /var/www/html/webmail/libraries/ProjectCore/Actions.php(2971): CApiIntegratorManager->loginToAccount('abdelrahman.wah...', '', '', '', Array)
#8 [internal function]: ProjectCore\Actions->AjaxSystemLogin()
#9 /var/www/html/webmail/libraries/ProjectCore/Service.php(341): call_user_func(Array)
#10 /var/www/html/webmail/libraries/ProjectCore/Boot.php(12): ProjectCore\Service->Handle()
#11 /var/www/html/webmail/index.php(104): include('/var/www/html/w...')
#12 {main}
[10:54:49.10][7efad605] Exception[1011]: Can't connect to mail server
~ /libraries/afterlogic/common/managers/users/manager.php (537)
----------------------------------------------------------------------
#0 /var/www/html/webmail/libraries/afterlogic/common/managers/webmail/manager.php(141): CApiUsersManager->createAccount(Object(CAccount), true)
#1 /var/www/html/webmail/libraries/afterlogic/common/managers/integrator/manager.php(823): CApiWebmailManager->createAccount('abdelrahman.wah...', '', '', Array)
#2 /var/www/html/webmail/libraries/ProjectCore/Actions.php(2971): CApiIntegratorManager->loginToAccount('abdelrahman.wah...', '', '', '', Array)
#3 [internal function]: ProjectCore\Actions->AjaxSystemLogin()
#4 /var/www/html/webmail/libraries/ProjectCore/Service.php(341): call_user_func(Array)
#5 /var/www/html/webmail/libraries/ProjectCore/Boot.php(12): ProjectCore\Service->Handle()
#6 /var/www/html/webmail/index.php(104): include('/var/www/html/w...')
#7 {main}
[10:54:49.10][7efad605] IMAP[NOTE]: Disconnected from "tcp://imap-mail.outlook.com:993" (success)
[10:54:49.10][7efad605] Exception[1011]: Can't connect to mail server
~ /libraries/afterlogic/common/managers/users/manager.php (537)
----------------------------------------------------------------------
#0 /var/www/html/webmail/libraries/afterlogic/common/managers/webmail/manager.php(141): CApiUsersManager->createAccount(Object(CAccount), true)
#1 /var/www/html/webmail/libraries/afterlogic/common/managers/integrator/manager.php(823): CApiWebmailManager->createAccount('abdelrahman.wah...', '', '', Array)
#2 /var/www/html/webmail/libraries/ProjectCore/Actions.php(2971): CApiIntegratorManager->loginToAccount('abdelrahman.wah...', '
', '', '', Array)
#3 [internal function]: ProjectCore\Actions->AjaxSystemLogin()
#4 /var/www/html/webmail/libraries/ProjectCore/Service.php(341): call_user_func(Array)
#5 /var/www/html/webmail/libraries/ProjectCore/Boot.php(12): ProjectCore\Service->Handle()
#6 /var/www/html/webmail/index.php(104): include('/var/www/html/w...')
#7 {main}
[10:54:49.10][7efad605] Event: abdelrahman.wahdan@outlook.com > login-failed
[10:54:49.10][7efad605] CApiManagerException: Can't connect to mail server in /var/www/html/webmail/libraries/afterlogic/common/managers/users/manager.php:537
Stack trace:
#0 /var/www/html/webmail/libraries/afterlogic/common/managers/webmail/manager.php(141): CApiUsersManager->createAccount(Object(CAccount), true)
#1 /var/www/html/webmail/libraries/afterlogic/common/managers/integrator/manager.php(823): CApiWebmailManager->createAccount('abdelrahman.wah...', '', '', Array)
#2 /var/www/html/webmail/libraries/ProjectCore/Actions.php(2971): CApiIntegratorManager->loginToAccount('abdelrahman.wah...', ', '', '', Array)
#3 [internal function]: ProjectCore\Actions->AjaxSystemLogin()
#4 /var/www/html/webmail/libraries/ProjectCore/Service.php(341): call_user_func(Array)
#5 /var/www/html/webmail/libraries/ProjectCore/Boot.php(12): ProjectCore\Service->Handle()
#6 /var/www/html/webmail/index.php(104): include('/var/www/html/w...')
#7 {main}

Next ProjectCore\Exceptions\ClientException: ClientException in /var/www/html/webmail/libraries/ProjectCore/Actions.php:3012
Stack trace:
#0 [internal function]: ProjectCore\Actions->AjaxSystemLogin()
#1 /var/www/html/webmail/libraries/ProjectCore/Service.php(341): call_user_func(Array)
#2 /var/www/html/webmail/libraries/ProjectCore/Boot.php(12): ProjectCore\Service->Handle()
#3 /var/www/html/webmail/index.php(104): include('/var/www/html/w...')
#4 {main}
afterlogic-support commented 7 years ago

Aha, looks like it requires to have SSL enabled explicitly. In the plugin code, add the following lines for both the domains, alongside those connection details already there:

$oAccountToCreate->IncomingMailUseSSL = true;
$oAccountToCreate->OutgoingMailUseSSL = true;

Hope it helps.

afterlogic-support commented 7 years ago

Also, we've adjusted the documentation page of the plugin accordingly.

abdelrahmanahmed commented 7 years ago

ok now i can login only with gmail accounts, but i can't send emails ,this errors happened An error occurred during sending the message. (530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError c34sm31835005wra.80 - gsmtp)

and i followed this links with its instructions but nothing happened (still the same error )

the second issue i can't login with any outlook or hotmail accounts (wrong smtp/imap port maybe?) ,

afterlogic-support commented 7 years ago

I wonder if you have SMTP Authentication option checked in Default settings - "Use incoming mail's login/password of the user" one. If not, you can still enable it for specific domain in the plugin code:

$oAccountToCreate->OutgoingMailAuth = \ESMTPAuthType::AuthCurrentUser;

No idea about the 2nd one, hope you find it out.

abdelrahmanahmed commented 7 years ago

not its not checked in default settings ,and after adding $oAccountToCreate->OutgoingMailAuth = \ESMTPAuthType::AuthCurrentUser; i still getting the same error

afterlogic-support commented 7 years ago

But, did you delete and recreate an account after making the changes? As per the plugin documentation, that's required:

The plugin only takes effect when account is created on first login, so if the account already exists in WebMail database, no changes will be made to it, you would need to delete the account first for custom changes to apply for it.

abdelrahmanahmed commented 7 years ago

ok my bad , now i can send mails and receive using gmail accounts Thanks a lot. the only thing left is to configure other domains, i will try my best to make them works too, and i will info you there any progress.