RainLoop / rainloop-webmail

Simple, modern & fast web-based email client
http://rainloop.net
MIT License
4.11k stars 891 forks source link

SMTP issue: Not sending Mails since Rainloop v1.10.1.x #1138

Open deMattin opened 8 years ago

deMattin commented 8 years ago

Hello, I have an issue with sending mails in all Rainloop versions 1.10.1.123 and up. Last working version is 1.10.0.107.

In newer versions I am able to login, fetch mails, move and archive mails (so imap is working fine). But when I try to send a newly created mail I get an "authentification error" with a red bubble error message at the send button. I tried different settings for my mail provider (checked green as working) and tried to disabled CRAM-MD5 but nothing helps. I also got in contact with my hoster but form his side he only sees "incorrect authentication data".

Switching back to 1.10.0.107 (modificate APP_VERSION in .../rainloop/app/index.php in owncloud apps folder) solves the issue immediatly without changing login-credentials or settings.

The issue is only with my private mail account hosted by 1blu.de - other providers and mail accounts like outlook.com, gmail, gmx and so on work fine. From my side the only difference is, that I have to use the plugin "custom-login-mapping" to rewrite login credentials for 1blu-mail-provider. I use the owncloud Rainloop app (4.0) with updates from admin center in rainloop.

Any idea, how to fix this and find the cause of the issue? I love rainloop as best solution for integration in owncloud and it's no real solution to get stuck on Rainloop version 1.10.1.123 ;)

Thanks, Martin

[22:16:54.162][2f6e90eb] INFO[DATA]: [DATE:13.07.16][RL:1.10.2.143][PHP:5.6.23-1~dotdeb+7.1][IP:192.168.1.20][PID:13208][Apache/2.2.22 (Debian)][apache2handler]
[22:16:54.174][2f6e90eb] INFO[DATA]: [Suhosin:off][APC:on][MB:on][PDO:mysql,pgsql,sqlite][ownCloud:true][Streams:tcp,udp,unix,udg,ssl,sslv3,tls,tlsv1.0,tlsv1.1,tlsv1.2]
[22:16:54.184][2f6e90eb] REQUEST[NOTE]: [POST] https://domain.tld/owncloud/index.php/apps/rainloop/app/?/Ajax/&q[]=/_2y4cyQPcAk74v9im3bdoeoqFXx5IcaFblablablubblub.../
[22:16:54.195][2f6e90eb] AJAX[NOTE]: Action: DoSendMessage
[22:16:54.204][2f6e90eb] POST[DATA]: {"IdentityID":"","MessageFolder":"Drafts","MessageUid":"1362","SentFolder":"Sent","To":"\"Empfänger\" <empfänger@domain.tld>","Cc":"","Bcc":"","ReplyTo":"","Subject":"test","TextIsHtml":"1","Text":"<div data-html-editor-font-wrapper=\"true\" style=\"font-family: arial, sans-serif; font-size: 13px;\"><div data-x-div-type=\"html\"><div data-x-div-type=\"body\"><div style=\"font-family: arial, sans-serif;font-size: 13px\">test<\/div><\/div><\/div><\/div>","DraftInfo":"","InReplyTo":"","References":"","Dsn":"0","ReadReceiptRequest":"0","MarkAsImportant":"0","Action":"SendMessage","XToken":"4c8251394d133171554e1ba1816429a5"}
[22:16:54.230][2f6e90eb] IMAP[NOTE]: Start connection to "ssl://imap.1blu.de:993"
[22:16:54.364][2f6e90eb] IMAP[NOTE]: Connected (success)
[22:16:54.419][2f6e90eb] IMAP[DATA]: < * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.\r\n
[22:16:54.443][2f6e90eb] IMAP[DATA]: > TAG1 AUTHENTICATE PLAIN\r\n
[22:16:54.896][2f6e90eb] IMAP[DATA]: < + \r\n
[22:16:54.917][2f6e90eb] IMAP[SECURE]: > *******\r\n
[22:16:55.161][2f6e90eb] IMAP[DATA]: < TAG1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in\r\n
[22:16:55.225][2f6e90eb] SMTP[NOTE]: Start connection to "ssl://smtp.1blu.de:465"
[22:16:55.407][2f6e90eb] SMTP[NOTE]: Connected (success)
[22:16:55.417][2f6e90eb] SMTP[DATA]: < 220 ms-10.1blu.de ESMTP Exim 4.76 Thu, 14 Jul 2016 00:16:58 +0200\r\n
[22:16:55.428][2f6e90eb] SMTP[DATA]: > EHLO sub.domain.tld\r\n
[22:16:55.443][2f6e90eb] SMTP[DATA]: < 250-ms-10.1blu.de Hello sub.domain.tld [109.91.222.135]\r\n
[22:16:55.453][2f6e90eb] SMTP[DATA]: < 250-SIZE 104857600\r\n
[22:16:55.463][2f6e90eb] SMTP[DATA]: < 250-PIPELINING\r\n
[22:16:55.473][2f6e90eb] SMTP[DATA]: < 250-AUTH LOGIN PLAIN\r\n
[22:16:55.483][2f6e90eb] SMTP[DATA]: < 250 HELP\r\n
[22:16:55.494][2f6e90eb] SMTP[DATA]: > AUTH PLAIN\r\n
[22:16:55.511][2f6e90eb] SMTP[DATA]: < 535 Incorrect authentication data\r\n
[22:16:55.522][2f6e90eb] SMTP[ERROR]: exception 'MailSo\Smtp\Exceptions\NegativeResponseException' with message '535 Incorrect authentication data' in /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/MailSo/Smtp/SmtpClient.php:789
Stack trace:
#0 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/MailSo/Smtp/SmtpClient.php(670): MailSo\Smtp\SmtpClient->validateResponse(334)
#1 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/MailSo/Smtp/SmtpClient.php(256): MailSo\Smtp\SmtpClient->sendRequestWithCheck('AUTH', 334, 'PLAIN')
#2 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Model/Account.php(521): MailSo\Smtp\SmtpClient->Login('seems to map correct credentials here...', '*******', true, true)
#3 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Actions.php(6233): RainLoop\Model\Account->OutConnectAndLoginHelper(Object(RainLoop\Plugins\Manager), Object(MailSo\Smtp\SmtpClient), Object(RainLoop\Config\Application), false)
#4 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Actions.php(6391): RainLoop\Actions->smtpSendMessage(Object(RainLoop\Model\Account), Object(MailSo\Mime\Message), Resource id #58, 1009, false, true)
#5 [internal function]: RainLoop\Actions->DoSendMessage()
#6 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/ServiceActions.php(172): call_user_func(Array)
#7 [internal function]: RainLoop\ServiceActions->ServiceAjax('')
#8 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Service.php(146): call_user_func(Array, '')
#9 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Service.php(56): RainLoop\Service->localHandle()
#10 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/RainLoop/Service.php(79): RainLoop\Service->__construct()
#11 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/handle.php(94): RainLoop\Service::Handle()
#12 /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/include.php(225): include('/var/www/ownclo...')
#13 /var/www/owncloud/apps/rainloop/app/index.php(12): include('/var/www/ownclo...')
#14 /var/www/owncloud/apps/rainloop/app.php(33): include('/var/www/ownclo...')
#15 /var/www/owncloud/lib/private/route/route.php(154) : runtime-created function(1): require_once('/var/www/ownclo...')
#16 [internal function]: __lambda_func(Array)
#17 /var/www/owncloud/lib/private/route/router.php(291): call_user_func('\x00lambda_627', Array)
#18 /var/www/owncloud/lib/base.php(853): OC\Route\Router->match('/apps/rainloop/...')
#19 /var/www/owncloud/index.php(39): OC::handleRequest()
#20 {main}
[22:16:55.534][2f6e90eb] SMTP[NOTICE]: exception 'MailSo\Smtp\Exceptions\NegativeResponseException' with message '535 Incorrect authentication data' in /var/www/owncloud/apps/rainloop/app/rainloop/v/1.10.2.143/app/libraries/MailSo/Smtp/SmtpClient.php:789
RainLoop commented 8 years ago

Try this:

<rainloop-data>/...../application.ini

[labs]
smtp_use_auth_plain = Off
deMattin commented 8 years ago

Great! One simple (labs) setting and it works again with actual version of rainloop.

I think you understand the background for this error on sending mails with default settingsmtp_use_auth_plan = On - but "normal" user/admin doesn't. Do you see a chance to automate this that way, that there is no need to set this (and perhaps also other) labs-settings? Maybe that way: App tries to send (or receive) mail with default-setting - app sees error - tries next possible setting - and so on until it works. And if a working combination is found, then app stores this working setting in config. The order of the various attempts could be from securest setting to less secure settings.

Automatically storing the successful setting should be made, to not try not working settings on every attempt again.

PS: I don't understand, why auth-plain isn't working. Doesn't the mails server ask for auth-plain as a working auth?

[22:16:54.419][2f6e90eb] IMAP[DATA]: < * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.\r\n
...
[22:16:55.473][2f6e90eb] SMTP[DATA]: < 250-AUTH LOGIN PLAIN\r\n
[22:16:55.483][2f6e90eb] SMTP[DATA]: < 250 HELP\r\n
[22:16:55.494][2f6e90eb] SMTP[DATA]: > AUTH PLAIN\r\n
[22:16:55.511][2f6e90eb] SMTP[DATA]: < 535 Incorrect authentication data\r\n

PS2: Which SMTP auth is used instead of plain?

github-k8n commented 6 years ago

Same issue here.

Rainloop simply does not send any authentication data at all (nothing after "AUTH PLAIN") Disabling plain auth method is not an option for me (having ldap auth on the backend means having to send the pw to the server and can't use CRAM-MD5 or others..)

github-k8n commented 6 years ago

Found the issue.

For reference if someone has the same issues:

Seems to be an issue with dovecot auth SASL/exim and the way rainloop behaves. With AUTH PLAIN and no initial response argument, my config using exim and dovecot SASL with LDAP backend will not return an empty challenge as per RFC but instead directly return a 535 error.

Option 1: First thing, rainloop seems to avoid sending the auth data as "initial response" argument during the AUTH PLAIN. There is a hardcoded variable in rainloop/v/1.11.3/app/libraries/MailSo/Smtp/SmtpClient.php public $__USE_SINGLE_LINE_AUTH_PLAIN_COMMAND = false;

Changing it seems to work.

Option 2: Allow "LOGIN" auth in smtp server (and e.g. in my case in the dovecot SASL backend) and set smtp_use_auth_plain = Off (you can probably configure that one in rainloop by logging in as admin) => now rainloop will try LOGIN auth

Option 3: Try to fix dovecot sasl /exim (will try to do now :-)