Where does mail app save the settings?

Hello Team,

Iā€™ve been trying to connect the mail app to our locally hosted mail server. I use a webclient and I can use Thuderbird to connect to our ClearOS mail server with no issues. But if I use the same settings in Nextcloud mail the settings save correctly but upon saving I canā€™t connect. Nextcloud Mail app always says I have an SMTP error?

Iā€™ve checked ports and my Nextcloud can get to both port 143 and 25.
Iā€™ve confirmed that the same settings work find on my Thunderbird.

Where can I find the settings I enter on my Nextcloud Server (what file and location) from the Mail App settings page? I donā€™t think the settings Iā€™m entering are being saved and used when I open Mail.

Iā€™ve looked in the Nextcloud logs and I can see the following errors:

[mail] Fatal: Updating account failed: Error connecting to SMTP server.
AND

{ā€œreqIdā€:ā€œXGm5Fnhr7PYPrOnnz4g46wAAAAMā€,ā€œlevelā€:3,ā€œtimeā€:ā€œ2019-02-17T19:42:24+00:00ā€,ā€œremoteAddrā€:ā€œ192.168.1.1ā€,ā€œuserā€:ā€œ27F9C913-0BE4-497E-BE67-992F307B8378ā€,ā€œappā€:ā€œmailā€,ā€œmethodā€:ā€œGETā€,ā€œurlā€:"/nextcloud/index.php/apps/mail/api/accounts/3/folders",ā€œmessageā€:{ā€œExceptionā€:ā€œHorde_Imap_Client_Exception_ServerResponseā€,ā€œMessageā€:ā€œIMAP error reported by server.ā€,ā€œCodeā€:0,ā€œTraceā€:[{ā€œfileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",ā€œlineā€:4309,ā€œfunctionā€:"_getLine",ā€œclassā€:ā€œHorde_Imap_Client_Socketā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œdataā€:{ā€œmodseqsā€:[],ā€œmodseqs_nouidā€:[]},ā€œfetchā€:{ā€œclassā€:ā€œHorde_Imap_Client_Fetch_Resultsā€},ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Pipelineā€}]},{ā€œfileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",ā€œlineā€:4237,ā€œfunctionā€:"_sendCmdChunk",ā€œclassā€:ā€œHorde_Imap_Client_Socketā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œdataā€:{ā€œmodseqsā€:[],ā€œmodseqs_nouidā€:[]},ā€œfetchā€:{ā€œclassā€:ā€œHorde_Imap_Client_Fetch_Resultsā€},ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Pipelineā€},[{ā€œdebugā€:[],ā€œliteralplusā€:true,ā€œliteral8ā€:false,ā€œon_errorā€:null,ā€œon_successā€:null,ā€œpipelineā€:{ā€œdataā€:{ā€œmodseqsā€:[],ā€œmodseqs_nouidā€:[]},ā€œfetchā€:{ā€œclassā€:ā€œHorde_Imap_Client_Fetch_Resultsā€},ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Pipelineā€},ā€œresponseā€:{ā€œtagā€:ā€œ86ā€,ā€œresponseCodeā€:null,ā€œstatusā€:3,ā€œtokenā€:{ā€œclassā€:ā€œHorde_Imap_Client_Tokenizeā€},ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Server_Taggedā€},ā€œtagā€:ā€œ86ā€,ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Commandā€}]]},{ā€œfileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",ā€œlineā€:1751,ā€œfunctionā€:"_sendCmd",ā€œclassā€:ā€œHorde_Imap_Client_Socketā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œdataā€:{ā€œmodseqsā€:[],ā€œmodseqs_nouidā€:[]},ā€œfetchā€:{ā€œclassā€:ā€œHorde_Imap_Client_Fetch_Resultsā€},ā€œclassā€:ā€œHorde_Imap_Client_Interaction_Pipelineā€}]},{ā€œfileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",ā€œlineā€:1728,ā€œfunctionā€:"_status",ā€œclassā€:ā€œHorde_Imap_Client_Socketā€,ā€œtypeā€:"->",ā€œargsā€:[[{ā€œclassā€:ā€œHorde_Imap_Client_Mailboxā€}],8205]},{ā€œfileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php",ā€œlineā€:4033,ā€œfunctionā€:ā€œstatusā€,ā€œclassā€:ā€œHorde_Imap_Client_Baseā€,ā€œtypeā€:"->",ā€œargsā€:[[ā€œPublic folders/Swas Labs Folders/Vendors & Suppliers /Petronor Haricana ā€œ],8205]},{ā€œfileā€:ā€/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.phpā€,ā€œlineā€:3585,ā€œfunctionā€:"_syncStatus",ā€œclassā€:ā€œHorde_Imap_Client_Baseā€,ā€œtypeā€:"->",ā€œargsā€:[ā€œPublic folders/Swas Labs Folders/Vendors & Suppliers /Petronor Haricana ā€œ]},{ā€œfileā€:ā€/usr/share/nextcloud/apps/mail/lib/IMAP/FolderMapper.phpā€,ā€œlineā€:69,ā€œfunctionā€:ā€œgetSyncTokenā€,ā€œclassā€:ā€œHorde_Imap_Client_Baseā€,ā€œtypeā€:"->",ā€œargsā€:[ā€œPublic folders/Swas Labs Folders/Vendors & Suppliers /Petronor Haricana ā€œ]},{ā€œfileā€:ā€/usr/share/nextcloud/apps/mail/lib/Service/MailManager.phpā€,ā€œlineā€:87,ā€œfunctionā€:ā€œgetFoldersā€,ā€œclassā€:ā€œOCA\Mail\IMAP\FolderMapperā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œclassā€:ā€œOCA\Mail\Accountā€},{ā€œcacheFieldsā€:{ā€œ1ā€:ā€œHICstructā€,ā€œ8ā€:ā€œHIChdrsā€,ā€œ9ā€:ā€œHICenvā€,ā€œ10ā€:ā€œHICflagsā€,ā€œ11ā€:ā€œHICdateā€,ā€œ12ā€:ā€œHICsizeā€},ā€œchangedā€:true,ā€œstatuscacheā€:true,ā€œclassā€:ā€œHorde_Imap_Client_Socketā€}]},{ā€œfileā€:"/usr/share/nextcloud/apps/mail/lib/Controller/FoldersController.php",ā€œlineā€:74,ā€œfunctionā€:ā€œgetFoldersā€,ā€œclassā€:ā€œOCA\Mail\Service\MailManagerā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œclassā€:ā€œOCA\Mail\Accountā€}]},{ā€œfileā€:"/usr/share/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",ā€œlineā€:166,ā€œfunctionā€:ā€œindexā€,ā€œclassā€:ā€œOCA\Mail\Controller\FoldersControllerā€,ā€œtypeā€:"->",ā€œargsā€:[3]},{ā€œfileā€:"/usr/share/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",ā€œlineā€:99,ā€œfunctionā€:ā€œexecuteControllerā€,ā€œclassā€:ā€œOC\AppFramework\Http\Dispatcherā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œclassā€:ā€œOCA\Mail\Controller\FoldersControllerā€},ā€œindexā€]},{ā€œfileā€:"/usr/share/nextcloud/lib/private/AppFramework/App.php",ā€œlineā€:118,ā€œfunctionā€:ā€œdispatchā€,ā€œclassā€:ā€œOC\AppFramework\Http\Dispatcherā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œclassā€:ā€œOCA\Mail\Controller\FoldersControllerā€},ā€œindexā€]},{ā€œfileā€:"/usr/share/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",ā€œlineā€:47,ā€œfunctionā€:ā€œmainā€,ā€œclassā€:ā€œOC\AppFramework\Appā€,ā€œtypeā€:"::",ā€œargsā€:[ā€œOCA\Mail\Controller\FoldersControllerā€,ā€œindexā€,{ā€œclassā€:ā€œOC\AppFramework\DependencyInjection\DIContainerā€},{ā€œaccountIdā€:ā€œ3ā€,"_route":ā€œmail.folders.indexā€}]},{ā€œfunctionā€:"__invoke",ā€œclassā€:ā€œOC\AppFramework\Routing\RouteActionHandlerā€,ā€œtypeā€:"->",ā€œargsā€:[{ā€œaccountIdā€:ā€œ3ā€,"_route":ā€œmail.folders.indexā€}]},{ā€œfileā€:"/usr/share/nextcloud/lib/private/Route/Router.php",ā€œlineā€:297,ā€œfunctionā€:ā€œcall_user_funcā€,ā€œargsā€:[{ā€œclassā€:ā€œOC\AppFramework\Routing\RouteActionHandlerā€},{ā€œaccountIdā€:ā€œ3ā€,"_route":ā€œmail.folders.indexā€}]},{ā€œfileā€:"/usr/share/nextcloud/lib/base.php",ā€œlineā€:987,ā€œfunctionā€:ā€œmatchā€,ā€œclassā€:ā€œOC\Route\Routerā€,ā€œtypeā€:"->",ā€œargsā€:["/apps/mail/api/accounts/3/folders"]},{ā€œfileā€:"/usr/share/nextcloud/index.php",ā€œlineā€:42,ā€œfunctionā€:ā€œhandleRequestā€,ā€œclassā€:ā€œOCā€,ā€œtypeā€:"::",ā€œargsā€:[]}],ā€œFileā€:"/usr/share/nextcloud/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Socket.php",ā€œLineā€:4597,ā€œCustomMessageā€:"ā€“"},ā€œuserAgentā€:ā€œMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36ā€,ā€œversionā€:ā€œ15.0.4.0ā€,ā€œidā€:ā€œ5c69bb35b8d60ā€}

Hello Forum,

Iā€™m doing some more digging and I see reference from this post that I could update a file like so:

What file and where does this file live where I could add the following:

ā€˜app.mail.accounts.defaultā€™ => [
ā€˜emailā€™ => ā€˜%USERID%@yourdomain.atā€™ā€˜,
ā€˜imapHostā€™ => ā€˜imap.yourserver.comā€™,
ā€˜imapPortā€™ => 993,
ā€˜imapUserā€™ => ā€˜%USERID%@yourdomain.atā€™,
ā€˜imapSslModeā€™ => ā€˜sslā€™,
ā€˜smtpHostā€™ => ā€˜smtp.yourserver.comā€™,
ā€˜smtpPortā€™ => 486,
ā€˜smtpUserā€™ => ā€˜%USERID%@yourdomain.atā€™ā€™,
ā€˜smtpSslModeā€™ => ā€˜noneā€™, ],

Thank you,

See https://github.com/nextcloud/mail/blob/master/doc/admin.md

Hello @ChristophWurst and thank you for this reply. I apologize for the delay in responding to you.

Iā€™ve read that linke alreadyā€¦but I donā€™t know what config.php itā€™s referring too? Can you tell me where this config.php file lives please and perhaps where in that file I add in the mail details?

Alsoā€¦I donā€™t understand why the Nextcloud Mail App doesnā€™t work for us inputting the details on the GUI for our mail server. Rainloop (also a Nextcloud App for mail), Roundcube, Thunderbird all work pointing to our ClearOS (Zarafa) mail server with no issues. Iā€™ve never been able to get this Nextcloud Mail app to work. Iā€™ve asked a friend of mine who also uses Nextcloud and he also has never been able to get this Nextcloud Mail app to work? Is there a trick or something we are all missing?

Any advice or pointers you can provide for me would be greatly appreciated.

Thank you.

You can find it documented here: https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/config_sample_php_parameters.html#configuration-parameters