Mail app gets loaded
Internal server error
0.17.0
ubuntu server 18.04 + docker-compose with nextcloud:latest (17.0) + mariadb
System integrity: check
Firefox/69.0
Ubuntu 18.04
I was trying to add my first mail account into mail app (SSL on both smtp and imap) and I was encountering generic errors, so I've enabled debug in my config and I had this
{"reqId":"95qexcN6zulTTpsAhrqf","level":0,"time":"2019-10-13T03:27:30+00:00","remoteAddr":"<redacted>","user":"<redacted>","app":"PHP","method":"POST","url":"\/apps\/mail\/api\/accounts","message":"stream_socket_client(): SSL operation failed
with code 1. OpenSSL Error messages:\nerror:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure at \/var\/www\/html\/custom_apps\/mail\/vendor\/pear-pear.horde.org\/Horde_Socket_Client\/Horde\/Socket\/Client.php#293","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"17.0.0.9"}
{"reqId":"95qexcN6zulTTpsAhrqf","level":0,"time":"2019-10-13T03:27:30+00:00","remoteAddr":"<redacted>","user":"<redacted>","app":"PHP","method":"POST","url":"\/apps\/mail\/api\/accounts","message":"stream_socket_client(): Failed to enable crypto at \/var\/www\/html\/custom_apps\/mail\/vendor\/pear-pear.horde.org\/Horde_Socket_Client\/Horde\/Socket\/Client.php#293","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"17.0.0.9"}
{"reqId":"95qexcN6zulTTpsAhrqf","level":0,"time":"2019-10-13T03:27:30+00:00","remoteAddr":"<redacted>","user":"<redacted>","app":"PHP","method":"POST","url":"\/apps\/mail\/api\/accounts","message":"stream_socket_client(): unable to connect to
ssl:\/\/mail.redacted.com:993 (Unknown error) at \/var\/www\/html\/custom_apps\/mail\/vendor\/pear-pear.horde.org\/Horde_Socket_Client\/Horde\/Socket\/Client.php#293","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko\/20100101 Firefox\/69.0","version":"17.0.0.9"}
So I went for some TLS debugging on my server, and I still have to find an answer for this.
$ openssl s_client -connect mail.redacted.com:993
CONNECTED(00000005)
140585384337856:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../ssl/record/rec_layer_s3.c:1528:SSL alert number 40
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 320 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
After a lot of failed attempts (same credentials works on desktop clients) I tried unencrypted auth on both server and the app went KO. Now I get an internal server error every time I click on mail icon. I keep getting internal server error even after uninstalling and reinstalling the app.
Now I have to keep the mail app completely disabled to hide the internal server error from other users :(
I have 2 problems to solve:
Here the stacktrace of the internal server error
{
"reqId":"w6sxMIOpOGgt7RCDPAxO",
"level":3,
"time":"2019-10-13T02:02:21+00:00",
"remoteAddr":"<edit>",
"user":"<edit>",
"app":"index",
"method":"GET",
"url":"/apps/mail/",
"message":{
"Exception":"Exception",
"Message":"explode() expects parameter 1 to be string, null given",
"Code":0,
"Trace":[
{
"file":"/var/www/html/lib/private/AppFramework/App.php",
"line":126,
"function":"dispatch",
"class":"OC\\AppFramework\\Http\\Dispatcher",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Controller\\PageController"
},
"index"
]
},
{
"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php",
"line":47,
"function":"main",
"class":"OC\\AppFramework\\App",
"type":"::",
"args":[
"OCA\\Mail\\Controller\\PageController",
"index",
{
"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"
},
{
"_route":"mail.page.index"
}
]
},
{
"function":"__invoke",
"class":"OC\\AppFramework\\Routing\\RouteActionHandler",
"type":"->",
"args":[
{
"_route":"mail.page.index"
}
]
},
{
"file":"/var/www/html/lib/private/Route/Router.php",
"line":297,
"function":"call_user_func",
"args":[
{
"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"
},
{
"_route":"mail.page.index"
}
]
},
{
"file":"/var/www/html/lib/base.php",
"line":1000,
"function":"match",
"class":"OC\\Route\\Router",
"type":"->",
"args":[
"/apps/mail/"
]
},
{
"file":"/var/www/html/index.php",
"line":42,
"function":"handleRequest",
"class":"OC",
"type":"::",
"args":[
]
}
],
"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"Line":109,
"Previous":{
"Exception":"TypeError",
"Message":"explode() expects parameter 1 to be string, null given",
"Code":0,
"Trace":[
{
"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php",
"line":219,
"function":"explode",
"args":[
null,
"INBOX",
2
]
},
{
"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php",
"line":200,
"function":"guessSpecialUse",
"class":"OCA\\Mail\\IMAP\\FolderMapper",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Folder"
}
]
},
{
"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php",
"line":158,
"function":"detectSpecialUse",
"class":"OCA\\Mail\\IMAP\\FolderMapper",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Folder"
}
]
},
{
"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php",
"line":79,
"function":"detectFolderSpecialUse",
"class":"OCA\\Mail\\IMAP\\FolderMapper",
"type":"->",
"args":[
[
{
"__class__":"OCA\\Mail\\Folder"
},
{
"__class__":"OCA\\Mail\\SearchFolder"
},
{
"__class__":"OCA\\Mail\\Folder"
},
{
"__class__":"OCA\\Mail\\Folder"
}
]
]
},
{
"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php",
"line":81,
"function":"sync",
"class":"OCA\\Mail\\IMAP\\MailboxSync",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Account"
}
]
},
{
"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php",
"line":111,
"function":"getFolders",
"class":"OCA\\Mail\\Service\\MailManager",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Account"
}
]
},
{
"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line":170,
"function":"index",
"class":"OCA\\Mail\\Controller\\PageController",
"type":"->",
"args":[
]
},
{
"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
"line":99,
"function":"executeController",
"class":"OC\\AppFramework\\Http\\Dispatcher",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Controller\\PageController"
},
"index"
]
},
{
"file":"/var/www/html/lib/private/AppFramework/App.php",
"line":126,
"function":"dispatch",
"class":"OC\\AppFramework\\Http\\Dispatcher",
"type":"->",
"args":[
{
"__class__":"OCA\\Mail\\Controller\\PageController"
},
"index"
]
},
{
"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php",
"line":47,
"function":"main",
"class":"OC\\AppFramework\\App",
"type":"::",
"args":[
"OCA\\Mail\\Controller\\PageController",
"index",
{
"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"
},
{
"_route":"mail.page.index"
}
]
},
{
"function":"__invoke",
"class":"OC\\AppFramework\\Routing\\RouteActionHandler",
"type":"->",
"args":[
{
"_route":"mail.page.index"
}
]
},
{
"file":"/var/www/html/lib/private/Route/Router.php",
"line":297,
"function":"call_user_func",
"args":[
{
"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"
},
{
"_route":"mail.page.index"
}
]
},
{
"file":"/var/www/html/lib/base.php",
"line":1000,
"function":"match",
"class":"OC\\Route\\Router",
"type":"->",
"args":[
"/apps/mail/"
]
},
{
"file":"/var/www/html/index.php",
"line":42,
"function":"handleRequest",
"class":"OC",
"type":"::",
"args":[
]
}
],
"File":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php",
"Line":219
},
"CustomMessage":"--"
},
"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0",
"version":"17.0.0.9",
"id":"5da285b08d57d"
}
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
After more debugging I've concluded that:
but if I use no encryption on IMAP connection (plain connection on port 143) I get the internal server error:
{"reqId":"W9jRHgwL4N9LTq16LnIz","level":3,"time":"2019-10-13T17:17:13+00:00","remoteAddr":"
","user":" ","app":"index","method":"GET","url":"/apps/mail/","message":{"Exception":"Exception","Message":"explode() expects parameter 1 to be string, null given","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":126,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"__class__":"OCA\Mail\Controller\PageController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Mail\Controller\PageController","index",{"__class__":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"mail.page.index"}]},{"function":"__invoke","class":"OC\AppFramework\Routing\RouteActionHandler","type":"->","args":[{"_route":"mail.page.index"}]},{"file":"/var/www/html/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\AppFramework\Routing\RouteActionHandler"},{"_route":"mail.page.index"}]},{"file":"/var/www/html/lib/base.php","line":1000,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/mail/"]},{"file":"/var/www/html/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"TypeError","Message":"explode() expects parameter 1 to be string, null given","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","line":219,"function":"explode","args":[null,"INBOX",2]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","line":200,"function":"guessSpecialUse","class":"OCA\Mail\IMAP\FolderMapper","type":"->","args":[{"__class__":"OCA\Mail\Folder"}]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","line":158,"function":"detectSpecialUse","class":"OCA\Mail\IMAP\FolderMapper","type":"->","args":[{"__class__":"OCA\Mail\Folder"}]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","line":79,"function":"detectFolderSpecialUse","class":"OCA\Mail\IMAP\FolderMapper","type":"->","args":[[{"__class__":"OCA\Mail\Folder"},{"__class__":"OCA\Mail\SearchFolder"},{"__class__":"OCA\Mail\Folder"},{"__class__":"OCA\Mail\Folder"}]]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":81,"function":"sync","class":"OCA\Mail\IMAP\MailboxSync","type":"->","args":[{"__class__":"OCA\Mail\Account"}]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":111,"function":"getFolders","class":"OCA\Mail\Service\MailManager","type":"->","args":[{"__class__":"OCA\Mail\Account"}]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"index","class":"OCA\Mail\Controller\PageController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"__class__":"OCA\Mail\Controller\PageController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":126,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"__class__":"OCA\Mail\Controller\PageController"},"index"]},{"file":"/var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Mail\Controller\PageController","index",{"__class__":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"mail.page.index"}]},{"function":"__invoke","class":"OC\AppFramework\Routing\RouteActionHandler","type":"->","args":[{"_route":"mail.page.index"}]},{"file":"/var/www/html/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\AppFramework\Routing\RouteActionHandler"},{"_route":"mail.page.index"}]},{"file":"/var/www/html/lib/base.php","line":1000,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/mail/"]},{"file":"/var/www/html/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","Line":219},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0","version":"17.0.0.9","id":"5da35c2035077"}
:"explode() expects parameter 1 to be string, null
This is quite a strange error. It can't locate/build the PageController instance.
What version of the Nextcloud server do you run?
I wrote it in the template
Nextcloud server 17.0.0
Nextcloud mail app 0.17.0
Hi,
Same case with bluewin.ch server (imaps.bluewin.ch:993 and smtpauths.bluewin.ch:465)
According to data/horde_imap.log and data/horde_smtp.log all communication is OK.
If it helps, on another application application that should read from bluewin.ch I had to change my imap communication from
imap_open ("{".MAILBOX."}INBOX", USERNAME, PASSWORD)
to
imap_open ("{".MAILBOX."}INBOX", USERNAME, PASSWORD,NULL, 1, array('DISABLE_AUTHENTICATOR' => 'PLAIN'))
This https://stackoverflow.com/questions/34183777/php-imap-open-server-bug-non-empty-initial-plain-challenge was quite helpfull
my config is:
Nextcloud server 17.0.1
Nextcloud mail app 0.18.1
BR,
Olivier
Same issue, it is because IMAP server sending NULL delimiter.
["INBOX"]=>
array(3) {
["delimiter"]=>
NULL
["mailbox"]=>
...
Update:
/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php - line 219: explode(null, "INBOX", 2)
Function $folder->getDelimiter() cannot return NULL or Empty to fix this issue. #2515
Do you have any insights on why the server wouldn't have a delimiter?
ChristophWurst changed the title ~"Message":"explode() expects parameter 1 to be string, null given"~ Mailbox delimiters are optional 25 seconds ago
Details https://github.com/nextcloud/mail/pull/2515#discussion_r369098946
My perspective on fixing issue
1) Allow NULL value in table oc_mail_mailboxes
ALTER TABLE oc_mail_mailboxes MODIFY delimiter varchar(1) DEFAULT NULL;
2) Skip explode in function guessSpecialUse /lib/IMAP/FolderMapper.php - line 219 if delimiter is NULL
if($folder->getDelimiter()) {
$lowercaseExplode = explode($folder->getDelimiter(), $folder->getMailbox(), 2);
} else {
$lowercaseExplode = array($folder->getMailbox());
}
3) Probably write some test with NULL delimiter to prevent same bug in future.
Sounds like a plan!
The table can be change with a migration.
We will also have to adjust the front-end code that builds the mailbox hierarchy to ignore the delimiter if there is none and just use a flat hierarchy
Hi there!
I ran into a similar issue with trying to link my work email (not gmail) with Nextcloud 20.0.0
Exception: Call to a member function getDelimiter() on bool
/var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "index")
/var/www/nextcloud/lib/private/Route/Router.php - line 308:
OC\AppFramework\App::main("OCA\\Mail\\ ... r", "index", OC\AppFramew ... {}, { action: nu ... "})
/var/www/nextcloud/lib/base.php - line 1009:
OC\Route\Router->match("/apps/mail/api/mailboxes")
/var/www/nextcloud/index.php - line 37:
OC::handleRequest()
Caused by Error: Call to a member function getDelimiter() on bool
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 169:
OCA\Mail\Controller\MailboxesController->index(30)
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 100:
OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Con ... {}, "index")
/var/www/nextcloud/lib/private/AppFramework/App.php - line 152:
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Con ... {}, "index")
/var/www/nextcloud/lib/private/Route/Router.php - line 308:
OC\AppFramework\App::main("OCA\\Mail\\ ... r", "index", OC\AppFramew ... {}, { action: nu ... "})
/var/www/nextcloud/lib/base.php - line 1009:
OC\Route\Router->match("/apps/mail/api/mailboxes")
/var/www/nextcloud/index.php - line 37:
OC::handleRequest()
in horde_imap.log I get the following strange short exchange of the servers:
>> Connection to: imap://imap.[removedservername]/:993/
>> Server connection took 0.0368 seconds.
S: * OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE MUPDATE=mupdate://muppet.[removedservername]/ AUTH=PLAIN SASL-IR] [removedservername] Cyrus IMAP Murder [removedservername] server ready
C: 1 AUTHENTICATE PLAIN [INITIAL CLIENT RESPONSE (username: [removeduser])]
S: 1 OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE ACL RIGHTS=kxten QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY CATENATE CONDSTORE ESEARCH SORT SORT=MODSEQ SORT=DISPLAY SORT=UID THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE ANNOTATE-EXPERIMENT-1 METADATA LIST-EXTENDED LIST-STATUS LIST-MYRIGHTS WITHIN QRESYNC SCAN XLIST SPECIAL-USE CREATE-SPECIAL-USE URLAUTH URLAUTH=BINARY X-NETSCAPE MUPDATE=mupdate://muppet.[removedservername]// LOGINDISABLED COMPRESS=DEFLATE X-QUOTA=STORAGE X-QUOTA=MESSAGE X-QUOTA=X-ANNOTATION-STORAGE X-QUOTA=X-NUM-FOLDERS IDLE] Success (tls protection) SESSIONID=<[removedstuff]>
>> Command 1 took 0.0124 seconds.
C: 2 NAMESPACE
S: * NAMESPACE (("INBOX." ".")) (("user." ".")) (("" "."))
S: 2 OK Completed
>> Command 2 took 0.004 seconds.
C: 3 LIST () "" (*) RETURN (SUBSCRIBED SPECIAL-USE)
S: 3 OK Completed (0.000 secs)
>> Command 3 took 0.1541 seconds.
C: 4 LOGOUT
S: * BYE LOGOUT received
S: 4 OK Completed
>> Command 4 took 0.0037 seconds.
I tried to play with the fix suggested by @MikyWoW, but the issue seems different right? Seems the imap server is not sending anything! I tried to connect to the server with several other apps, and it is working.
Is this a related issue?
Thanks and all the best,
Paul
I think it is not related to this issue. Your error is: 'Call to a member function getDelimiter() on bool'. Only one place that i found where this could occur: /lib/Controller/MailboxesController.php Line: 97
'delimiter' => reset($mailboxes)->getDelimiter(),
If array $mailboxes is empty then reset() is resolved as FALSE according to PHP docs
https://www.php.net/manual/en/function.reset.php
IMHO it is badly written. Try something like this:
$delimiter = '';
if(count($mailboxes) > 0)
{
$delimiter = reset($mailboxes)->getDelimiter();
}
return new JSONResponse([
'id' => $accountId,
'email' => $account->getEmail(),
'mailboxes' => $mailboxes,
'delimiter' => $delimiter,
]);
IMHO it is badly written.
Yes but OTOH an account without any mailbox is new to me. I don't think the RFC would even allow this. Isn't there always at least one mailbox, the inbox?
Yes root of problem could be somewhere else.
S: * NAMESPACE (("INBOX." ".")) (("user." ".")) (("" "."))
I am not sure how namespaces work but LIST command just with wildcard * could be problem?
C: 3 LIST () "" (*) RETURN (SUBSCRIBED SPECIAL-USE)
First namespace is personal. I would expect LIST on first namespace as prefix and delimiter then some kind of wildcard. Someting like: INBOX.%
Thank you @MikyWoW. I tried out your first fix, now the error message is gone, but the mailbox does not appear after finishing the setup. The logs stayed the same.. is there any more output that could be helpfull?
So probably the setup of the whole inbox is strange @ChristophWurst ? Inside
The mails seem to be directly in INBOX
then we have INBOX.Drafts , INBOX.Sent , INBOX.Trash ,.. and so on. If that makes sense?
Cheers!
mail/lib/IMAP/FolderMapper.php line 57
public function getFolders(Account $account, Horde_Imap_Client_Socket $client, string $pattern = '*'): array {
...
There is blindly pattern with * try to change that to INBOX.% or INBOX.* this should help with yours mail account but it is tailored just for that and definitly brakes other accounts. We need to rewrite sync function to fix this completly.
public function getFolders(Account $account, Horde_Imap_Client_Socket $client, string $pattern = 'INBOX.*'): array {
...
There is blindly pattern with * try to change that to INBOX.% or INBOX.* this should help with yours mail account but it is tailored just for that and definitly brakes other accounts. We need to rewrite sync function to fix this completly.
Interesting. So yeah we have access to the account's personal namespace there so we could use that for the pattern.
In RFC is this called leading prefix that needs to be in added to LIST command. RFC
Provided log: S: * NAMESPACE (("INBOX." ".")) (("user." ".")) (("" "."))
With just * it is probably searching in shared namespace.
Example 5.5:
===========
< A server that supports only the Personal Namespace, with a
leading prefix of INBOX to personal mailboxes and a hierarchy
delimiter of ".">
C: A001 NAMESPACE
S: * NAMESPACE (("INBOX." ".")) NIL NIL
S: A001 OK NAMESPACE command completed
This example is for users namespace but it should be same
Example 5.7:
===========
< A server that supports providing a list of other user's
mailboxes that are accessible to the currently logged on user. >
C: A001 NAMESPACE
S: * NAMESPACE (("" "/")) (("Other Users/" "/")) NIL
S: A001 OK NAMESPACE command completed
C: A002 LIST "" "Other Users/%"
S: * LIST () "/" "Other Users/Mike"
S: * LIST () "/" "Other Users/Karen"
S: * LIST () "/" "Other Users/Matthew"
S: * LIST () "/" "Other Users/Tesa"
S: A002 OK LIST command completed
Thanks. That makes sense. I'll make sure that we address this soon-ish and I hope someone will have some time to validate the fix with their setup. Would that be possible?
public function getFolders(Account $account, Horde_Imap_Client_Socket $client, string $pattern = 'INBOX.*'): array { ...Nice! Thank you very much for the answers! This gives me all the subfolders, but unfortunately the folder where the mail arrives misses. It seems the mail is stored directly in INBOX, but neither $pattern = '*', $pattern = 'INBOX%', or $pattern = 'INBOX' seems to recognize INBOX as a folder itself..
It's looks like INBOX isn't possible to get by LIST command. But INBOX is there always. Probably we need to add that manually.
But INBOX is there always.
Yes, but the casing is not standardized AFAIK, so it could be INBOX but also Inbox.
You can extract that from namespace prefix INBOX. Some reading about settings that enables this type of hierarchy: cyrus namespaces
You can extract that from namespace prefix
INBOX.Some reading about settings that enables this type of hierarchy: cyrus namespaces
I can? :sweat_smile: is there another simple fix I could try out?
My perspective on fixing issue
1. Allow NULL value in table `oc_mail_mailboxes`ALTER TABLE oc_mail_mailboxes MODIFY delimiter varchar(1) DEFAULT NULL;1. Skip explode in function `guessSpecialUse` /lib/IMAP/FolderMapper.php - line 219 if delimiter is NULLif($folder->getDelimiter()) { $lowercaseExplode = explode($folder->getDelimiter(), $folder->getMailbox(), 2); } else { $lowercaseExplode = array($folder->getMailbox()); }1. Probably write some test with NULL delimiter to prevent same bug in future.
This worked for me. Thanks!
Wow thanks @TheSkrypt for sharing your solution!! I was looking forward to trying it out, but since updating to v1.6.0 of the app I only get a " Request failed with status code 404 " when trying to add my mailbox! And nothing is shown in the debug log!!! How can I debug this?
EDIT: Alright, tried the fix of @TheSkrypt again, now I am getting again the "Request failed..." but also the following log:
[mail] Error: OCP\AppFramework\Db\DoesNotExistException: Special mailbox drafts does not exist at <<closure>>
0. /var/www/nextcloud/apps/mail/lib/Listener/MailboxesSynchronizedSpecialMailboxesUpdater.php line 74
OCA\Mail\Listener\MailboxesSynchronizedSpecialMailboxesUpdater->findSpecial([], "drafts")
1. /var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php line 76
OCA\Mail\Listener\MailboxesSynchronizedSpecialMailboxesUpdater->handle(OCA\Mail\Events\ ... {})
2. /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 251
OC\EventDispatcher\ServiceEventListener->__invoke(OCA\Mail\Events\ ... {}, "OCA\\Mail\\Even ... t", Symfony\Componen ... {})
3. /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php line 73
Symfony\Component\EventDispatcher\EventDispatcher->callListeners([Closure {}], "OCA\\Mail\\Even ... t", OCA\Mail\Events\ ... {})
4. /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php line 86
Symfony\Component\EventDispatcher\EventDispatcher->dispatch(OCA\Mail\Events\ ... {}, "OCA\\Mail\\Even ... t")
5. /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php line 98
OC\EventDispatcher\EventDispatcher->dispatch("OCA\\Mail\\Even ... t", OCA\Mail\Events\ ... {})
6. /var/www/nextcloud/apps/mail/lib/IMAP/MailboxSync.php line 125
OC\EventDispatcher\EventDispatcher->dispatchTyped(OCA\Mail\Events\ ... {})
7. /var/www/nextcloud/apps/mail/lib/Service/MailManager.php line 127
OCA\Mail\IMAP\MailboxSync->sync(OCA\Mail\Account {}, OC\AppFramework\ScopedPsrLogger {})
8. /var/www/nextcloud/apps/mail/lib/Controller/PageController.php line 119
OCA\Mail\Service\MailManager->getMailboxes(OCA\Mail\Account {})
9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 169
OCA\Mail\Controller\PageController->index()
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
OC\AppFramework\Http\Dispatcher->executeController(OCA\Mail\Controller\PageController {}, "index")
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 152
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Mail\Controller\PageController {}, "index")
12. /var/www/nextcloud/lib/private/Route/Router.php line 308
OC\AppFramework\App::main("OCA\\Mail\\Controller\\PageController", "index", OC\AppFramework\ ... {}, {action: null,_route: "mail.page.index"})
13. /var/www/nextcloud/lib/base.php line 1009
OC\Route\Router->match("/apps/mail/")
14. /var/www/nextcloud/index.php line 37
OC::handleRequest()
GET /nextcloud/index.php/apps/mail/
Hello @PaulSt ,
I had very similar problem as you ( Exception: explode() expects parameter 1 to be string, null given ),
this helped me:
DELETE FROM oc_migrations WHERE app='mail';
DELETE FROM oc_preferences WHERE appid='mail';
drop table oc_mail_accounts;
drop table oc_mail_attachments;
drop table oc_mail_aliases;
drop table oc_mail_coll_addresses;
drop table oc_mail_mailboxes;
drop table oc_mail_messages;
drop table oc_mail_recipients;
drop table oc_mail_classifiers;
- Allow NULL value in table
oc_mail_mailboxesALTER TABLE oc_mail_mailboxes MODIFY delimiter varchar(1) DEFAULT NULL;
- Skip explode in function
guessSpecialUse/lib/IMAP/FolderMapper.php - line 219 if delimiter is NULLif($folder->getDelimiter()) { $lowercaseExplode = explode($folder->getDelimiter(), $folder->getMailbox(), 2); } else { $lowercaseExplode = array($folder->getMailbox()); }
And now it works.
Synchronizing with email.cz work. Adding gmail.com account doesn麓t, but that is a different problem I guess.
Thank you all for this thread.
Server configuration:
Operating system: Ubuntu 20.04.1 LTS
Web server: Apache 2.4.41
Database: MariaDB 10.3.25
PHP: 7.4
Nextcloud version: 20.0.2