Setup mail fails with: Error while creating the account: Precondition failed

I have trouble setting up the mail app with my e-mail settings.
Nextcloud is running on the same server as mail. So I tried this settings:

bart@mailprovider.nl
localhost
143 none
bart@mailprovider.nl
password
localhost
587 none
bart@mailprovider.nl
password

I did try ssl en starttls
I tried mail.mailprovider.nl as server. This is the imap server I use in thunderbird.

I can not find anything in nextcloud.log. Does mail.app has its own log file?

The Nextcloud mail app offers an extensive logging system to make it easier identifying and tracking down bugs. Please enable debug mode and set the log level to debug in your admin settings. Then, try to reproduce your issue and take another look at data/nextcloud.log, data/horde_imap.log and data/horde_smtp.log.

Please make sure to not post any personal information like credentials.

If you find a bug please report it at https://github.com/nextcloud/mail/issues/new?assignees=&labels=bug%2C+0.+to+triage&template=bug.md&title=

Nextcloud.log shows me these lines:

{"reqId":"removed-by-me","level":3,"time":"2019-02-26T12:11:49+00:00","remoteAddr":"removed-ip-
adress","user":"removed-username","app":"mail ","method":"GET","url":"\/wolk
\/index.php\/apps\/mail\/api\/accounts\/-2\/folders","message":{"Exception":"
Horde_Imap_Client_Exception","Message":"Authentication
failed.","Code":102,"Trace":[{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/
public_html\/wolk\/apps\/mail\/vendor\/pear-pear. horde.org\/Horde_Imap_Client\/
Horde\/Imap\/Client\/Socket.php","line":4561,"function":"_responseCode","class":"
Horde_Imap_Client_Socket","type":"->","args":[{"data":{" modseqs":[],"modseqs_nouid":[],"
loginerr":{"raw_msg":"Authentication
failed.","details":null,"logged":false,"__class__":"Horde_Imap_Client_Exception"}},"fetch":{"
__class__":"Horde_Imap_Client_Fetch_Results"}," __class__":"
Horde_Imap_Client_Interaction_Pipeline"},{"tag":"1","responseCode":{"data":[],"code":"
AUTHENTICATIONFAILED","__class__":"stdClass"},"status"
:3,"token":{"__class__":"
Horde_Imap_Client_Tokenize"},"__class__":"Horde_Imap_Client_Interaction_Server_Tagged"}]},{"file":"\
/home\/removed-server\/domains\/removed- domain.nl\/public_html\/wolk\/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":[],"loginerr":{"raw_msg":"Authentication
failed.","details":null,"logged":false,"__class__":"Horde_Imap_Client_Exception"}},"fetch":{"
__class__":"Horde_Imap_Client_Fetch_Results"}," __class__":"
Horde_Imap_Client_Interaction_Pipeline"}]},{"file":"\/home\/removed-server\/domains\/removed-domain.
nl\/public_html\/wolk\/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":[],"
loginerr":{"raw_msg":"Authentication
failed.","details":null,"logged":false,"__class__":"Horde_Imap_Client_Exception"}},"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":[],"loginerr":{"raw_msg":"Authentication
failed.","details":null,"logged":false,"__class__":"Horde_Imap_Client_Exception"}},"fetch":{"
__class__":"Horde_Imap_Client_Fetch_Results"}," __class__":"
Horde_Imap_Client_Interaction_Pipeline"},"response":{"tag":"1","responseCode":{"data":[],"code":"
AUTHENTICATIONFAILED","__class__":"stdClass "},"status":3,"token":{"
__class__":"Horde_Imap_Client_Tokenize"},"__class__":"Horde_Imap_Client_Interaction_Server_Tagged"},
"tag":"1","__class__":" Horde_Imap_Client_Interaction_Command"}]]},{"
file":"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/wolk\/apps\/mail\/vendor\/
pear-pear.horde.org\/Horde_Imap_Client\/ Horde\/Imap\/Client\/Socket.php","line":846,"
function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->","args":[{"data":{"modseqs":[],"
modseqs_nouid":[],"loginerr":{"raw_msg":" Authentication
failed.","details":null,"logged":false,"__class__":"Horde_Imap_Client_Exception"}},"fetch":{"
__class__":"Horde_Imap_Client_Fetch_Results"}," __class__":"
Horde_Imap_Client_Interaction_Pipeline"}]},{"file":"\/home\/removed-server\/domains\/removed-domain.
nl\/public_html\/wolk\/apps\/mail\/ vendor\/pear-pear.horde.org\/Horde_Imap_Client\/
Horde\/Imap\/Client\/Socket.php","line":512,"function":"_tryLogin","class":"Horde_Imap_Client_Socket
","type":"->","args":["*** sensitive parameters replaced
***"]},{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/wolk\/apps\/mail\/
vendor\/pear-pear.horde.org\/ Horde_Imap_Client\/Horde\/Imap\/Client\/Base.php","line":
833,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive
parameters replaced
***"]},{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/wolk\/apps\/mail\/
vendor\/pear-pear.horde.org\/ Horde_Imap_Client\/Horde\/Imap\/Client\/Base.php","line":
1384,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive
parameters replaced
***"]},{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/wolk\/apps\/mail\/
lib\/IMAP\/FolderMapper.php","line":45," function":"listMailboxes","class":"
Horde_Imap_Client_Base","type":"->","args":["*",4,{"delimiter":true,"attributes":true,"special_use":
true}]},{"file":"\/home\/removed-server\
/domains\/removed-domain.nl\/public_html\/wolk
\/apps\/mail\/lib\/Service\/MailManager.php","line":87,"function":"getFolders","class":"OCA\\Mail\\
IMAP\\FolderMapper","type":"->","args":[{ "__class__":"OCA\\Mail\\
Account"},{"cacheFields":{"9":"HICenv","10":"HICflags","8":"HIChdrs","11":"HICdate","12":"HICsize","
1":"HICstruct"},"changed":true," statuscache":true,"__class__":"
Horde_Imap_Client_Socket"}]},{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/
public_html\/wolk\/apps\/mail\/lib\/Controller\/ FoldersController.php","line":74,"function":"
getFolders","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":[{"__class__":"OCA\\Mail\\
Account"}]},{"file":"\/home\/removed- server\/domains\/removed-domain.nl\/public_html\/
wolk\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"index","class":"OCA\\
Mail\\Controller\\FoldersController"," type":"->","args":[-2]},{"file":
"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/wolk\/lib\/private\/AppFramework\/
Http\/Dispatcher.php","line":99," function":"executeController","class":"OC\\
AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Mail\\Controller\\
FoldersController"},"index"]},{"file":"\/home\/ removed-server\/domains\/removed-domain.nl\/
public_html\/wolk\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC
\\AppFramework\\Http\\Dispatcher","type"
:"->","args":[{"__class__":"
OCA\\Mail\\Controller\\FoldersController"},"index"]},{"file":"\/home\/removed-server\/domains\/
removed-domain.nl\/public_html\/wolk\/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":"-2","_route":"mail.folders.index"
}]},{"function":"__invoke","class":"OC\\ AppFramework\\Routing\\
RouteActionHandler","type":"->","args":[{"accountId":"-2","_route":"mail.folders.index"}]},{"file":"
\/home\/removed-server\/domains\/removed -domain.nl\/public_html\/wolk\
/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\
/AppFramework\\Routing\\RouteActionHandler
"},{"accountId":"-2","_route":
"mail.folders.index"}]},{"file":"\/home\/removed-server\/domains\/removed-domain.nl\/public_html\/
wolk\/lib\/base.php","line":987,"function"
:"match","class":"OC\\Route\\
Router","type":"->","args":["\/apps\/mail\/api\/accounts\/-2\/folders"]},{"file":"\/home\/removed-
server\/domains\/removed-domain.nl\/ public_html\/wolk\/index.php","line"
:42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/home\/removed-server\/
:domains\/Removed-domain.nl\/public_html\
/wolk\/apps\/mail\/vendor\/
pear-pear.horde.org\/Horde_Imap_Client\/Horde\/Imap\/Client\/Socket.php","Line":5025,"CustomMessage"
:"--"},"userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko\/20100101
Firefox\/65.0","version":"15.0.2.0"}
 

Sorry, I do not know how to wrap code in here. (edit: Okay, i did find this out :wink: )
I do now have the log files: data/horde_imap.log and data/horde_smtp.log

Authentication failed -> try a different username or password :wink:

To easy :wink:
I even tried with a different e-mail account. The e-mail address and password are the same as I use in thunderbird, or in webmail.
The e-mail is formed like: bart.name@domain.nl Is the dot a problem?
My password starts with a _ is that possible the problem?

I just changed my password so it does not contain special symbols, but that did not solve the issue.
also another e-mail address without dot gives an error.
I have no clue where the problems is. Anyone?

Unexpected the message changed from: Error while creating the account: Precondition failed
to: Error while creating the account: Unauthorized
and now changed to Precondition failed again.
But still no luck setting up e-mail.

If you file a ticket at https://github.com/nextcloud/mail/issues/new?assignees=&labels=bug%2C+0.+to+triage&template=bug.md&title= I can have a closer look.