the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
1.03k stars 121 forks source link

Error "Authentication failed" when sending mail since v2.35.4 #1517

Closed koffienl closed 7 months ago

koffienl commented 7 months ago

Describe the bug Authentication failure when trying to send a email. Since v2.35.4 I get an error when sending mail: "Authentication failed" Reverting back to v2.35.3 works without any issue. Before testing previous snappymail version I tried several other SMTP clients and non gave any issue.

To Reproduce Login and try to send a email. I'm getting a "authentication failed" message.

Please complete the following information: I'm running docker with image djmaze/snappymail:latest Snappymail version 2.35.4

Debug/logging information {"Action":"Unknown","Result":false,"ErrorCode":903,"ErrorMessage":"InvalidInputArgument[903]","ErrorMessageAdditional":"Action unknown","ExceptionCode":0,"epoch":1711364413}

Error on console:

SMTP[ERROR]: MailSo\Smtp\Exceptions\NegativeResponseException: 535 5.7.8 535 Incorrect authentication data in /snappymail/snappymail/v/2.35.4/app/libraries/MailSo/Smtp/SmtpClient.php:596
Stack trace:
#0 /snappymail/snappymail/v/2.35.4/app/libraries/MailSo/Smtp/SmtpClient.php(504): MailSo\Smtp\SmtpClient->validateResponse(Array, '')
#1 /snappymail/snappymail/v/2.35.4/app/libraries/MailSo/Smtp/SmtpClient.php(192): MailSo\Smtp\SmtpClient->sendRequestWithCheck('AHJpY2hhcmQAWkV...', 235, true)
#2 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Model/Account.php(257): MailSo\Smtp\SmtpClient->Login(Object(MailSo\Smtp\Settings))
#3 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Model/Account.php(223): RainLoop\Model\Account->netClientLogin(Object(MailSo\Smtp\SmtpClient), Object(RainLoop\Plugins\Manager))
#4 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Actions/Messages.php(772): RainLoop\Model\Account->SmtpConnectAndLogin(Object(RainLoop\Plugins\Manager), Object(MailSo\Smtp\SmtpClient))
#5 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Actions/Messages.php(176): RainLoop\Actions->smtpSendMessage(Object(RainLoop\Model\MainAccount), Object(MailSo\Mime\Message), Resource id #28, 770, true, false, false)
#6 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/ServiceActions.php(134): RainLoop\Actions->DoSendMessage()
#7 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Service.php(132): RainLoop\ServiceActions->ServiceJson('')
#8 /snappymail/snappymail/v/2.35.4/app/libraries/RainLoop/Service.php(14): RainLoop\Service::RunResult()
#9 /snappymail/snappymail/v/2.35.4/include.php(135): RainLoop\Service::Handle()
#10 /snappymail/index.php(11): include('/snappymail/sna...')
#11 {main}
the-djmaze commented 7 months ago

We need debug info to check.

Like:

SMTP[INFO]: Start connection to "tcp://localhost:25"
SMTP[INFO]: Connect (success)
SMTP[INFO]: < 220 snappymail.eu ESMTP\r\n
SMTP[INFO]: > EHLO snappymail.eu\r\n
SMTP[INFO]: < 250-snappymail.eu\r\n
SMTP[INFO]: < 250-PIPELINING\r\n
SMTP[INFO]: < 250-SIZE 256000000\r\n
SMTP[INFO]: < 250-ETRN\r\n
SMTP[INFO]: < 250-STARTTLS\r\n
SMTP[INFO]: < 250-ENHANCEDSTATUSCODES\r\n
SMTP[INFO]: < 250-8BITMIME\r\n
SMTP[INFO]: < 250-DSN\r\n
SMTP[INFO]: < 250 SMTPUTF8\r\n
SMTP[INFO]: > STARTTLS\r\n
SMTP[INFO]: < 220 2.0.0 Ready to start TLS\r\n
SMTP[INFO]: > EHLO snappymail.eu\r\n
SMTP[INFO]: < 250-snappymail.eu\r\n
SMTP[INFO]: < 250-PIPELINING\r\n
SMTP[INFO]: < 250-SIZE 256000000\r\n
SMTP[INFO]: < 250-ETRN\r\n
SMTP[INFO]: < 250-AUTH PLAIN LOGIN\r\n
SMTP[INFO]: < 250-ENHANCEDSTATUSCODES\r\n
SMTP[INFO]: < 250-8BITMIME\r\n
SMTP[INFO]: < 250-DSN\r\n
SMTP[INFO]: < 250 SMTPUTF8\r\n
SMTP[INFO]: > AUTH PLAIN\r\n
SMTP[INFO]: < 334 \r\n
SMTP[INFO]: > ********\r\n
SMTP[INFO]: < 235 2.7.0 Authentication successful\r\n
koffienl commented 7 months ago

[2024-03-25 13:55:16.819][d3e58896] JSON[INFO]: Action: DoSendMessage                                                                                                                                       
[2024-03-25 13:55:16.819][d3e58896] POST[INFO]: {"identityID":"","messageFolder":"","messageUid":0,"saveFolder":"Sent","from":"<user@domain.com>","to":"test@domein.nl","cc":"","bcc":"","repl
yTo":"","subject":"tt","draftInfo":null,"inReplyTo":"","references":"","markAsImportant":0,"attachments":[],"dsn":0,"requireTLS":0,"readReceiptRequest":0,"autocrypt":[],"linkedData":[],"html":"<div>tt<\/d
iv>","plain":"tt","Action":"SendMessage"}                                                                                                                                                                   
[2024-03-25 13:55:16.820][d3e58896] IMAP[INFO]: Start connection to "tcp://192.168.2.25:143"                                                                                                                
[2024-03-25 13:55:16.820][d3e58896] IMAP[INFO]: Connect (success)                                                                                                                                           
[2024-03-25 13:55:16.820][d3e58896] IMAP[DEBUG]: 0.00032687187194824 (raw connection)                                                                                                                       
[2024-03-25 13:55:16.820][d3e58896] IMAP[INFO]: < * OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ STARTTLS AUTH=PLAIN] Dovecot ready.\r\n                                        
[2024-03-25 13:55:16.821][d3e58896] IMAP[DEBUG]: 0.00083398818969727 (*)                                                                                                                                    
[2024-03-25 13:55:16.821][d3e58896] IMAP[INFO]: > TAG1 AUTHENTICATE PLAIN *******\r\n                                                                                                                       
[2024-03-25 13:55:16.838][d3e58896] IMAP[INFO]: < TAG1 OK [CAPABILITY IMAP4rev1 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 ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW 
STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE] Logged in\r\n                                                                                                                                             
[2024-03-25 13:55:16.839][d3e58896] IMAP[DEBUG]: 0.017486095428467 (TAG1)                                                                                                                                   
[2024-03-25 13:55:16.846][d3e58896] SMTP[INFO]: Start connection to "ssl://smtp.bhosted.nl:465"                                                                                                             
[2024-03-25 13:55:16.900][d3e58896] SMTP[INFO]: Connect (success)                                                                                                                                           
[2024-03-25 13:55:16.900][d3e58896] SMTP[DEBUG]: 0.053545951843262 (raw connection)                                                                                                                         
[2024-03-25 13:55:16.913][d3e58896] SMTP[INFO]: < 220 smtp.bhosted.nl ESMTP\r\n                                                                                                                             
[2024-03-25 13:55:16.914][d3e58896] SMTP[INFO]: > EHLO ...com\r\n                                                                                                                            
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-smtp.bhosted.nl\r\n                                                                                                                                   
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-PIPELINING\r\n                                                                                                                                        
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-SIZE 41943040\r\n                                                                                                                                     
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-AUTH LOGIN PLAIN\r\n                                                                                                                                  
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-ENHANCEDSTATUSCODES\r\n                                                                                                                               
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250-8BITMIME\r\n                                                                                                                                          
[2024-03-25 13:55:16.927][d3e58896] SMTP[INFO]: < 250 SMTPUTF8\r\n                                                                                                                                          
[2024-03-25 13:55:16.930][d3e58896] SMTP[INFO]: > AUTH PLAIN\r\n                                                                                                                                            
[2024-03-25 13:55:16.942][d3e58896] SMTP[INFO]: < 334 \r\n                                                                                                                                                  
[2024-03-25 13:55:16.943][d3e58896] SMTP[INFO]: > ********\r\n                                                                                                                                              
[2024-03-25 13:55:16.955][d3e58896] SMTP[INFO]: < 535 5.7.8 535 Incorrect authentication data\r\n                                                                                                           
[2024-03-25 13:55:16.958][d3e58896] SMTP[ERROR]: MailSo\Smtp\Exceptions\NegativeResponseException: 535 5.7.8 535 Incorrect authentication data in /snappymail/snappymail/v/2.35.4/app/libraries/MailSo/Smtp/
SmtpClient.php:596                                                                     ```
the-djmaze commented 7 months ago

As i can see, the login for IMAP is different compared to SMTP. Do you have:? afbeelding

koffienl commented 7 months ago

As i can see, the login for IMAP is different compared to SMTP. Do you have:? afbeelding

I don't have the lowercase setting, other than that: yes these are my settings. Just to be clear: this setup with local IMAP and remote SMTP with current settings works in previous versions. I can reproduce by using v2.35.4

the-djmaze commented 7 months ago

Just to be clear: this setup with local IMAP and remote SMTP

Your local IMAP uses "short login" but the remote SMTP does not. That's why it failed, because the "short login" was passed to SMTP.