nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
818 stars 255 forks source link

Fails to connect to an email server running dovecot 2.3.21 and postfix 3.9.0 #9612

Closed berolinux closed 1 day ago

berolinux commented 2 months ago

Steps to reproduce

  1. Try to configure a mail account

Expected behavior

Mail account is configured, can proceed to my mail

Actual behavior

"SMTP connection failed" -- but the access data is correct and other mail applications (KMail, SOGo, K9 Mail) connect to the same server fine. The mail server is running on the same machine as nextcloud, definitely no firewall issue or stuff like that. SSL certificates look fine (and are accepted by the other mail applications).

Mail app version

3.6.0

Mailserver or service

local mail server setup using dovecot 2.3.21 and postfix 3.9.0

Operating system

OpenMandriva Cooker on aarch64

PHP engine version

Other

Web server

Nginx

Database

PostgreSQL

Additional info

When the error happens, occ log says

  Error    mail               OCA\Mail\Exception\ServiceException: IMAP error synchronizing 2024-04-29T20:12:31+00:00 
                              account 7: IMAP error reported by server. at                                            
                              apps/mail/lib/IMAP/MailboxSync.php line 125                                             

                              0. .../AccountsController.php line 411                                                  
                                 OCA\Mail\IMAP\MailboxSync->sync("*** sensitive p ... *")                             
                              1. .../Dispatcher.php line 232                                                          
                                 OCA\Mail\Controller\AccountsController->create(" ... *")                             
                              2. .../Dispatcher.php line 138                                                          
                                 OC\AppFramework\Http\Dispatcher->executeController(                                  
                                   ["OCA\\Mail\\Controller\\AccountsControlle ... "],                                 
                                   "crea ... e"                                                                       
                                 )                                                                                    
                              3. .../App.php line 184                                                                 
                                 OC\AppFramework\Http\Dispatcher->dispatch(                                           
                                   ["OCA\ ... "],                                                                     
                                   "create"                                                                           
                                 )                                                                                    
                              4. .../Route/Router.php line 338                                                        
                                 OC\AppFramework\App::main(                                                           
                                   "OCA\\Mail\\Controller ... r",                                                     
                                   "create",                                                                          
                                   ["OC\\AppFramework\\De ... "],                                                     
                                   ["mail.accounts.create"]                                                           
                                 )                                                                                    
                              5. lib/base.php line 1050                                                               
                                 OC\Route\Router->match("\/apps\/mail\/api\/accounts")                                
                              6. index.php line 49                                                                    
                                 OC::handleRequest(                                                                   

                                 )                                                                                    

                              Caused by Horde_Imap_Client_Exception_ServerResponse: IMAP error                           
                              reported by server. at                                                                  
                              .../horde-imap-client/lib/Horde/Imap/Client/Socket.php line                             
                              4620                                                                                    

                               0. .../Socket.php line 4319                                                            
                                  Horde_Imap_Client_Socket->_getLine(["Horde_Imap ... ]])                             
                               1. .../Socket.php line 4243                                                            
                                  Horde_Imap_Client_Socket->_sendCmdChunk(                                            
                                    ["Horde ... ]],                                                                   
                                    [["Hord ... ]]                                                                    
                                  )                                                                                   
                               2. .../Socket.php line 3903                                                            
                                  Horde_Imap_Client_Socket->_sendCmd(["Horde_Imap ... "])                             
                               3. .../Base.php line 3330                                                              
                                  Horde_Imap_Client_Socket->_getMyACLRights(["Hor ... "])                             
                               4. .../FolderMapper.php line 132                                                       
                                  Horde_Imap_Client_Base->getMyACLRights("Archive")                                   
                               5. .../MailboxSync.php line 123                                                        
                                  OCA\Mail\IMAP\FolderMapper->fetchFolderAcls(                                        
                                    [[" ... "],                                                                       
                                    ["O ... e]                                                                        
                                  )                                                                                   
                               6. .../AccountsController.php line 411                                                 
                                  OCA\Mail\IMAP\MailboxSync->sync("*** sensitive  ... *")                             
                               7. .../Dispatcher.php line 232                                                         
                                  OCA\Mail\Controller\AccountsController->create( ... *")                             
                               8. .../Dispatcher.php line 138                                                         
                                  OC\AppFramework\Http\Dispatcher->executeController(                                 
                                    ["OCA\\Mail\\Controller\\AccountsControll ... "],                                 
                                    "cre ... e"                                                                       
                                  )                                                                                   
                               9. .../App.php line 184                                                                
                                  OC\AppFramework\Http\Dispatcher->dispatch(                                          
                                    ["OCA ... "],                                                                     
                                    "create"                                                                          
                                  )                                                                                   
                              10. .../Route/Router.php line 338                                                       
                                  OC\AppFramework\App::main(                                                          
                                    "OCA\\Mail\\Controlle ... r",                                                     
                                    "create",                                                                         
                                    ["OC\\AppFramework\\D ... "],                                                     
                                    ["mail.accounts.create"]                                                          
                                  )                                                                                   
                              11. lib/base.php line 1050                                                              
                                  OC\Route\Router->match("\/apps\/mail\/api\/accounts")                               
                              12. index.php line 49                                                                   
                                  OC::handleRequest(                                                                  

                                  )                                                                                   

  Error    mail               OCA\Mail\Exception\ServiceException: IMAP error synchronizing 2024-04-29T20:12:31+00:00 
                              account 7: IMAP error reported by server. at                                            
                              apps/mail/lib/IMAP/MailboxSync.php line 125                                             

                              0. .../MailManager.php line 148                                                         
                                 OCA\Mail\IMAP\MailboxSync->sync("*** sensitive p ... *")                             
                              1. .../MailboxesController.php line 86                                                  
                                 OCA\Mail\Service\MailManager->getMailboxes("***  ... *")                             
                              2. .../Dispatcher.php line 232                                                          
                                 OCA\Mail\Controller\MailboxesController->index(7)                                    
                              3. .../Dispatcher.php line 138                                                          
                                 OC\AppFramework\Http\Dispatcher->executeController(                                  
                                   ["OCA\\Mail\\Controller\\MailboxesControlle ... "],                                
                                   "ind ... x"                                                                        
                                 )                                                                                    
                              4. .../App.php line 184                                                                 
                                 OC\AppFramework\Http\Dispatcher->dispatch(                                           
                                   ["OCA\ ... "],                                                                     
                                   "index"                                                                            
                                 )                                                                                    
                              5. .../Route/Router.php line 338                                                        
                                 OC\AppFramework\App::main(                                                           
                                   "OCA\\Mail\\Controller ... r",                                                     
                                   "index",                                                                           
                                   ["OC\\AppFramework\\De ... "],                                                     
                                   ["mail.mailboxes.index"]                                                           
                                 )                                                                                    
                              6. lib/base.php line 1050                                                               
                                 OC\Route\Router->match("\/apps\/mail\/api\/mailboxes")                               
                              7. index.php line 49                                                                    
                                 OC::handleRequest(                                                                   

                                 )                                                                                    

                              Caused by Horde_Imap_Client_Exception_ServerResponse: IMAP error                           
                              reported by server. at                                                                  
                              .../horde-imap-client/lib/Horde/Imap/Client/Socket.php line                             
                              4620                                                                                    

                               0. .../Socket.php line 4319                                                            
                                  Horde_Imap_Client_Socket->_getLine(["Horde_Imap ... ]])                             
                               1. .../Socket.php line 4243                                                            
                                  Horde_Imap_Client_Socket->_sendCmdChunk(                                            
                                    ["Horde ... ]],                                                                   
                                    [["Hord ... ]]                                                                    
                                  )                                                                                   
                               2. .../Socket.php line 3903                                                            
                                  Horde_Imap_Client_Socket->_sendCmd(["Horde_Imap ... "])                             
                               3. .../Base.php line 3330                                                              
                                  Horde_Imap_Client_Socket->_getMyACLRights(["Hor ... "])                             
                               4. .../FolderMapper.php line 132                                                       
                                  Horde_Imap_Client_Base->getMyACLRights("Archive")                                   
                               5. .../MailboxSync.php line 123                                                        
                                  OCA\Mail\IMAP\FolderMapper->fetchFolderAcls(                                        
                                    [[" ... "],                                                                       
                                    ["O ... e]                                                                        
                                  )                                                                                   
                               6. .../MailManager.php line 148                                                        
                                  OCA\Mail\IMAP\MailboxSync->sync("*** sensitive  ... *")                             
                               7. .../MailboxesController.php line 86                                                 
                                  OCA\Mail\Service\MailManager->getMailboxes("*** ... *")                             
                               8. .../Dispatcher.php line 232                                                         
                                  OCA\Mail\Controller\MailboxesController->index(7)                                   
                               9. .../Dispatcher.php line 138                                                         
                                  OC\AppFramework\Http\Dispatcher->executeController(                                 
                                    ["OCA\\Mail\\Controller\\MailboxesControll ... "],                                
                                    "in ... x"                                                                        
                                  )                                                                                   
                              10. .../App.php line 184                                                                
                                  OC\AppFramework\Http\Dispatcher->dispatch(                                          
                                    ["OCA ... "],                                                                     
                                    "index"                                                                           
                                  )                                                                                   
                              11. .../Route/Router.php line 338                                                       
                                  OC\AppFramework\App::main(                                                          
                                    "OCA\\Mail\\Controlle ... r",                                                     
                                    "index",                                                                          
                                    ["OC\\AppFramework\\D ... "],                                                     
                                    ["mail.mailboxes.index"]                                                          
                                  )                                                                                   
                              12. lib/base.php line 1050                                                              
                                  OC\Route\Router->match("\/apps\/mail\/api\/mailboxes")                              
                              13. index.php line 49                                                                   
                                  OC::handleRequest(                                                                  

                                  )                                                                                    

The mail server log shows the connection attempt, but no indication of anything going wrong.

Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap-login: Login: user=<bero@lindev.ch>, method=PLAIN, rip=81.221.122.240, lip=10.64.65.42, mpid=597535, session=<hVCO30EXOthR3Xrw>
Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap(bero@lindev.ch)<597535><hVCO30EXOthR3Xrw>: Disconnected: Logged out in=26 out=551 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Apr 29 22:12:04 emag.lindev.ch postfix/submission/smtpd[597536]: warning: hostname 240-122-221-81.static.dsl-net.ch does not resolve to address 81.221.122.240: Name or service not known
Apr 29 22:12:04 emag.lindev.ch postfix/submission/smtpd[597536]: connect from unknown[81.221.122.240]
Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap-login: Login: user=<bero@lindev.ch>, method=PLAIN, rip=81.221.122.240, lip=10.64.65.42, mpid=597544, session=<UaqQ30EXPthR3Xrw>
Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap(bero@lindev.ch)<597544><UaqQ30EXPthR3Xrw>: Disconnected: Logged out in=109 out=993 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0
Apr 29 22:12:04 emag.lindev.ch postfix/submission/smtpd[597536]: disconnect from unknown[81.221.122.240] ehlo=1 quit=1 commands=2
Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap-login: Login: user=<bero@lindev.ch>, method=PLAIN, rip=81.221.122.240, lip=10.64.65.42, mpid=597548, session=<i1WU30EXTthR3Xrw>
Apr 29 22:12:04 emag.lindev.ch dovecot[584131]: imap(bero@lindev.ch)<597548><i1WU30EXTthR3Xrw>: Disconnected: Logged out in=109 out=1001 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0

php version is 8.3.6

SebastianKrupinski commented 2 months ago

Hi @berolinux,

Look like its failing while trying to retrieve the ACL for the 'Archive' folder. "Horde_Imap_Client_Base->getMyACLRights("Archive")"

Is there anything special with this folder?

Can you enable the Nextcloud debug mode ('debug' => true,) in the config and try connecting to the mailbox again?

Then post the output of the horde_imap.log

SebastianKrupinski commented 1 day ago

Closed for no response