Mail: Mailaccounts cannot be added/loaded after upgrading to 0.7

Created on 28 Aug 2017  路  18Comments  路  Source: nextcloud/mail

Steps to reproduce

  1. Add mailaccount to mail app
  2. Try to load mail account

Expected behaviour

Mail account hierarchy should be shown

Actual behaviour

Message "Error while loading the selected account" is shown

General server configuration

Operating system: Linux server 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64

Web server: Apache/2.4.25 (Debian) OpenSSL/1.0.2l mod_qos/11.36 (apache2handler)

Database: mysql 10.1.26

PHP version: 7.0.19-1


PHP-modules loaded

 - Core
 - date
 - libxml
 - openssl
 - pcre
 - zlib
 - filter
 - hash
 - Reflection
 - SPL
 - session
 - standard
 - apache2handler
 - mysqlnd
 - PDO
 - xml
 - apcu
 - apc
 - calendar
 - ctype
 - curl
 - dom
 - mbstring
 - fileinfo
 - ftp
 - gd
 - gettext
 - iconv
 - igbinary
 - imagick
 - imap
 - intl
 - json
 - exif
 - mcrypt
 - mysqli
 - pdo_mysql
 - Phar
 - posix
 - readline
 - redis
 - shmop
 - SimpleXML
 - sockets
 - sysvmsg
 - sysvsem
 - sysvshm
 - tokenizer
 - wddx
 - xmlreader
 - xmlwriter
 - xsl
 - zip
 - Zend OPcache

Nextcloud configuration

Nextcloud version: 12.0.2 - 12.0.2.0

Are you using encryption: no


Signing status

[]


Enabled apps

 - activity: 2.5.2
 - admin_audit: 1.2.0
 - admin_notifications: 1.0.0
 - announcementcenter: 3.1.0
 - bookmarks: 0.10.1
 - bruteforcesettings: 1.0.2
 - calendar: 1.5.3
 - checksum: 0.3.5
 - circles: 0.12.4
 - comments: 1.2.0
 - contacts: 1.5.3
 - dav: 1.3.0
 - drawio: 0.8.8
 - external: 2.0.3
 - federatedfilesharing: 1.2.0
 - federation: 1.2.0
 - files: 1.7.2
 - files_accesscontrol: 1.2.4
 - files_automatedtagging: 1.2.2
 - files_clipboard: 0.6.4
 - files_downloadactivity: 1.1.1
 - files_external: 1.3.0
 - files_markdown: 1.0.1
 - files_pdfviewer: 1.1.1
 - files_retention: 1.1.2
 - files_sharing: 1.4.0
 - files_texteditor: 2.4.1
 - files_trashbin: 1.2.0
 - files_versions: 1.5.0
 - files_videoplayer: 1.1.0
 - firstrunwizard: 2.1
 - gallery: 17.0.0
 - groupfolders: 1.1.0
 - impersonate: 1.0.1
 - issuetemplate: 0.2.2
 - logreader: 2.0.0
 - lookup_server_connector: 1.0.0
 - mail: 0.7.0
 - nextcloud_announcements: 1.1
 - notifications: 2.0.0
 - oauth2: 1.0.5
 - onlyoffice: 1.1.3
 - ownbackup: 17.5.0
 - ownnote: 1.08
 - passman: 2.1.4
 - password_policy: 1.2.2
 - provisioning_api: 1.2.0
 - quota_warning: 1.0.1
 - ransomware_protection: 1.0.1
 - serverinfo: 1.2.0
 - sharebymail: 1.2.0
 - socialsharing_email: 1.0.1
 - spreed: 2.0.1
 - survey_client: 1.0.0
 - systemtags: 1.2.0
 - tasks: 0.9.5
 - theming: 1.3.0
 - twofactor_backupcodes: 1.1.1
 - twofactor_totp: 1.3.1
 - updatenotification: 1.2.0
 - workflowengine: 1.2.0


Disabled apps

 - encryption
 - user_external
 - user_ldap


Content of config/config.php

{
    "instanceid": "**REMOVED SENSITIVE VALUE***",
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "**REMOVED SENSITIVE VALUE***"
    ],
    "datadirectory": "**REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "**REMOVED SENSITIVE VALUE***",
    "dbtype": "mysql",
    "version": "12.0.2.0",
    "dbname": "**REMOVED SENSITIVE VALUE***",
    "dbhost": "127.0.0.1",
    "dbtableprefix": "oc_",
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "mail_smtpmode": "smtp",
    "forcessl": true,
    "forceSSLforSubdomains": true,
    "theme": "",
    "maintenance": false,
    "mail_from_address": "**REMOVED SENSITIVE VALUE***",
    "mail_domain": "**REMOVED SENSITIVE VALUE***",
    "mail_smtphost": "**REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "25",
    "app.mail.imaplog.enabled": true,
    "loglevel": 0,
    "memcache.local": "\\OC\\Memcache\\APCu",
    "ldapIgnoreNamingRules": false,
    "trashbin_retention_obligation": "auto",
    "filelocking.enabled": "true",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "localhost",
        "port": 6379,
        "timeout": 0
    },
    "singleuser": true,
    "updatechecker": true,
    "auth.bruteforce.protection.enabled": true,
    "enabledPreviewProviders": [
        "OC\\Preview\\PNG",
        "OC\\Preview\\JPEG",
        "OC\\Preview\\GIF",
        "OC\\Preview\\BMP",
        "OC\\Preview\\XBitmap",
        "OC\\Preview\\MP3",
        "OC\\Preview\\TXT",
        "OC\\Preview\\MarkDown"
    ],
    "mail_smtpauthtype": "PLAIN"
}

Client configuration

Operating system: Debian 9

Logs


Web server error log

Insert your webserver log here


Nextcloud log (data/nextcloud.log)

{"reqId":"cmghXKCMQUs0TfI4MPyS","level":3,"time":"2017-08-28T14:40:29+00:00","remoteAddr":"141.201.13.83","user":"user","app":"index","method":"GET","url":"\/index.php\/apps\/mail\/accounts\/12\/folders","message":"Exception: {\"Exception\":\"Horde_Imap_Client_Exception_ServerResponse\",\"Message\":\"IMAP error reported by server.\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Socket.php(4302): Horde_Imap_Client_Socket->_getLine(Object(Horde_Imap_Client_Interaction_Pipeline))\\n#1 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Socket.php(4230): Horde_Imap_Client_Socket->_sendCmdChunk(Object(Horde_Imap_Client_Interaction_Pipeline), Array)\\n#2 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Socket.php(1751): Horde_Imap_Client_Socket->_sendCmd(Object(Horde_Imap_Client_Interaction_Pipeline))\\n#3 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Base.php(1728): Horde_Imap_Client_Socket->_status(Array, 8717)\\n#4 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Base.php(4033): Horde_Imap_Client_Base->status(Array, 8717)\\n#5 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Base.php(3585): Horde_Imap_Client_Base->_syncStatus('.Xauthority')\\n#6 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/lib\\\/Service\\\/FolderMapper.php(51): Horde_Imap_Client_Base->getSyncToken('.Xauthority')\\n#7 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/lib\\\/Service\\\/MailManager.php(70): OCA\\\\Mail\\\\Service\\\\FolderMapper->getFolders(Object(OCA\\\\Mail\\\\Account), Object(Horde_Imap_Client_Socket))\\n#8 \\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/lib\\\/Controller\\\/FoldersController.php(72): OCA\\\\Mail\\\\Service\\\\MailManager->getFolders(Object(OCA\\\\Mail\\\\Account))\\n#9 [internal function]: OCA\\\\Mail\\\\Controller\\\\FoldersController->index(12)\\n#10 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#11 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OCA\\\\Mail\\\\Controller\\\\FoldersController), 'index')\\n#12 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/App.php(114): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OCA\\\\Mail\\\\Controller\\\\FoldersController), 'index')\\n#13 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('OCA\\\\\\\\Mail\\\\\\\\Contro...', 'index', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#14 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#15 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/private\\\/Route\\\/Router.php(299): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#16 \\\/var\\\/www\\\/nextcloud\\\/lib\\\/base.php(1004): OC\\\\Route\\\\Router->match('\\\/apps\\\/mail\\\/acco...')\\n#17 \\\/var\\\/www\\\/nextcloud\\\/index.php(48): OC::handleRequest()\\n#18 {main}\",\"File\":\"\\\/var\\\/www\\\/nextcloud\\\/apps\\\/mail\\\/vendor\\\/pear-pear.horde.org\\\/Horde_Imap_Client\\\/Horde\\\/Imap\\\/Client\\\/Socket.php\",\"Line\":4590}","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"12.0.2.0"}
{"reqId":"rWFX7jSAtUIntiRe4A8N","level":0,"time":"2017-08-28T14:40:30+00:00","remoteAddr":"141.201.13.83","user":"user","app":"mail","method":"GET","url":"\/index.php\/apps\/mail\/accounts\/9\/folders\/SU5CT1g%3D\/messages?filter=","message":"loading messages of folder <SU5CT1g=>","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:55.0) Gecko\/20100101 Firefox\/55.0","version":"12.0.2.0"}
{"reqId":"ypyFJy3xmCJayAof1u92","level":0,"time":"2017-08-28T15:00:02+00:00","remoteAddr":"","user":"--","app":"cron","method":"--","url":"--","message":"Run OCA\\Activity\\BackgroundJob\\EmailNotification job with ID 373574","userAgent":"--","version":"12.0.2.0"}
{"reqId":"ypyFJy3xmCJayAof1u92","level":0,"time":"2017-08-28T15:00:02+00:00","remoteAddr":"","user":"--","app":"cron","method":"--","url":"--","message":"Finished OCA\\Activity\\BackgroundJob\\EmailNotification job with ID 373574 in 0 seconds","userAgent":"--","version":"12.0.2.0"}


------------------------------
>> Mon, 28 Aug 2017 14:34:26 +0000
>> Connection to: imap://myserver:993/
>> Server connection took 0.0444 seconds.
S: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
C: 1 AUTHENTICATE PLAIN [INITIAL CLIENT RESPONSE (username: user)]
S: 1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ES
ORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in
>> Command 1 took 0.0546 seconds.
>> CACHE: Using the OCA\Mail\Cache\Cache storage driver.
C: 2 ENABLE QRESYNC
C: 3 LOGOUT
S: * ENABLED QRESYNC
S: 2 OK Enabled.
>> Command 2 took 0.001 seconds.
S: * BYE Logging out
S: 3 OK Logout completed.
>> Command 3 took 0.0012 seconds.
------------------------------

1. to develop bug

All 18 comments

Additional info: It works well with an Exchange mail account served over IMAP.

I had a Google Apps for Domains mail account that stopped working with v0.7 and still isn't working in v0.7.1. Attempting to readd the account, as the OP has mentioned, also fails regardless of the settings used being known good or not.

"IMAP error reported by server.\"

@e-alfred this exception message does not really match with the actual IMAP log. The server-client communication looks okay to me. Are you sure those log entries were written when the reported error occurred?

I tried to separate out the log for the failing accounts from a Dovecot server. In the horde logs I added to the bug report I see that it logs in successfully but immediately logs out without downloading anything from the accounts. This does not happen with an Exchange IMAP account in there that still works well.

I got a very similar behaviour and Stacktrace. In my case I noticed that the Horde Client tried to get a sync lock to my sieve configuration wich was symlinked into the mail directory. Replacing the symlink with a copy of the file resolved the problem for me. Indeed this could only be a workaround.

@e-alfred maybe you can check if there is a .Xauthority because the exception states this filename in your case: Horde_Imap_Client_Base->getSyncToken('.Xauthority')

In my case, it looks like the issue I had was caused by my Google account moving to two factor authentication. I've generated an app password for it and everything's fine for me now.

Having the same issues. The account is logging in, but errors with "Error while loading the selected account."
Gmail IMAP works b.t.w.

In the dovecot log I see one error thats ignored by Roundcube/Outlook/Thunderbird:
Error: stat(/var/mail/vhosts/domain.com/username/.dovecot.sieve/tmp) failed: Not a directory

Maybe this is why Horde is stopping?

i noticed similar failure on my NextCloud install and noticed bunix42's mention of the issue potentially being related to his sieve configuration being symlnked into the mail directory. Since i also use a sieve configuration on my end i decided to follow his suggestion to replace the sieve symlink with a copy and that immediately made the mail box load properly as expected. So i would definitely say there is an issue with (sieve-)symlinks in general.

Thank you caelian.
I can confirm that the mail app (0.7.2/nextcloud 12.0.2) can create and access dovecot mailboxes that not have a sieve configuration on the same server that gives problems with accounts that do have a sieve configuration

Could someone please provide horde logs? You can find the instructions in the readme. nvm, they are in the ticket already.

This could be related/similar to https://github.com/nextcloud/mail/issues/267#issuecomment-286545238.

Hey, could someone of you temporarily provide me with an account on such a mailserver with a symlink so that I could try to reproduce and fix this? That would be awesome :)

Even better, but requires more effort is to integrate such an account in our testing server https://github.com/ChristophWurst/nextcloud-mail-test-docker.

This could be related/similar to #267 (comment).

If someone could try patch https://github.com/nextcloud/mail/issues/267#issuecomment-328827962, that would be great. If it's the very same attribute on this special folder/symlink, the patch could fix the problem. Let me know whether it does or does not fix the problem. Thanks!

I tried the patch provided with comment #267 and update 0.7.3, did not work.
If you still need a test email account, please let me know.

If you still need a test email account, please let me know.

Yes, please. That would be great. You can find my mail address in one of the license headers. Thanks!

You can find a fix in https://github.com/nextcloud/mail/pull/520. Please, everyone with a sieve managed account try the patch and let us know if it works for you too :)

Btw, I've found similar issues in other projects: https://github.com/tomav/docker-mailserver/issues/508. That indicates it could also be a misconfiguration on the mail server.

I have this problem with mail accounts not running/supporting Sieve (filtering and other stuff is done using Procmail), but the mail folder being mounted as a home directory of the user (yes, this is a bad setup, but I do not manage these mail servers). This means that all files created in a home directory by whatever application will be parsed by any IMAP client. It worked with the mail app before 0.7. I will check if there is an .Xauthority file as mentioned above.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristophWurst picture ChristophWurst  路  3Comments

jancborchardt picture jancborchardt  路  4Comments

CHazz picture CHazz  路  3Comments

sscherfke picture sscherfke  路  5Comments

UtechtDustin picture UtechtDustin  路  3Comments