Expected response code 250 but got code 553

Hi, I have a problem with owncloud It seems as it is trying to send mails with the user mail address instead of the address in smtp settings. My mail provider (Yandex) rejects this. Where can I change this behavior?

Steps to reproduce

  1. Specifiy a Yandex Mail as SMTP sender
  2. Create a new user (with another mail address)
  3. Set the password

Expected behaviour

The password should be changed, an email send to the user confirming the change.

Actual behaviour

The password is changed but an error appears that the mail could not be sent. In the log it seems as the Mail is intended to be sent with the user’s address and not with the address given in the SMTP settings page. Yandex rejects that

Server configuration

SMTP-Server: smtp.yandex.com
Port: 465
Authentication with Mail Address and App Password

Fresh install

Are you using encryption: no


ownCloud log (data/owncloud.log)

{“reqId”:“XXXX”,“level”:3,“time”:“2018-10-10T10:21:22+00:00”,“remoteAddr”:“xxx.xxx.xx.xxx”,“user”:"–",“app”:“settings”,“method”:“POST”,“url”:"/index.php/setpassword/926965384006339551257/user",“message”:“Exception: {“Exception”:“Swift_TransportException”,“Message”:“Expected response code 250 but got code \“553\”, with message \“553 5.7.1 Sender address rejected: not owned by auth user.\r\n\””,“Code”:553,“Trace”:”#0 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php(281): Swift_Transport_AbstractSmtpTransport->_assertResponseCode(‘553 5.7.1 Sende…’, Array)\n#1 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/EsmtpTransport.php(270): Swift_Transport_AbstractSmtpTransport->executeCommand(‘MAIL FROM:<use…’, Array, Array)\n#2 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/EsmtpTransport.php(346): Swift_Transport_EsmtpTransport->executeCommand(‘MAIL FROM:<use…’, Array)\n#3 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php(416): Swift_Transport_EsmtpTransport->_doMailFromCommand(‘user@example.com’)\n#4 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php(444): Swift_Transport_AbstractSmtpTransport->_doMailTransaction(Object(Swift_Message), ‘user@example.com’, Array, Array)\n#5 \/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php(176): Swift_Transport_AbstractSmtpTransport->_sendTo(Object(Swift_Message), ‘user@example.com’, Array, Array)\n#6 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/Mail\/Mailer.php(99): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array)\n#7 \/home\/PATH\/TO\/OWNCLOUD\/settings\/Controller\/UsersController.php(717): OC\\Mail\\Mailer->send(Object(OC\\Mail\\Message))\n#8 \/home\/PATH\/TO\/OWNCLOUD\/settings\/Controller\/UsersController.php(685): OC\\Settings\\Controller\\UsersController->sendNotificationMail(‘user’)\n#9 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/AppFramework\/Http\/Dispatcher.php(153): OC\\Settings\\Controller\\UsersController->setPassword(‘926965384006339…’, ‘user’, ‘PASS’)\n#10 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/AppFramework\/Http\/Dispatcher.php(85): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OC\\Settings\\Controller\\UsersController), ‘setPassword’)\n#11 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/AppFramework\/App.php(100): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OC\\Settings\\Controller\\UsersController), ‘setPassword’)\n#12 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(46): OC\\AppFramework\\App::main(‘UsersController’, ‘setPassword’, Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#13 \/home\/PATH\/TO\/OWNCLOUD\/lib\/private\/Route\/Router.php(342): OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#14 \/home\/PATH\/TO\/OWNCLOUD\/lib\/base.php(909): OC\\Route\\Router->match(’\/setpassword\/92…’)\n#15 \/home\/PATH\/TO\/OWNCLOUD\/index.php(54): OC::handleRequest()\n#16 {main}",“File”:"\/home\/PATH\/TO\/OWNCLOUD\/lib\/composer\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php",“Line”:383}"}

I would assume this is a problem with your provider - yandex.

Can you try a different provider like gmail and see if the problem persists?

Thanks for your reply!

Yeah it is related to my Provider,
I registered for example owncloud-admin @ yandex com and use it as SMTP sender.
Now I create a user with owncloud-user @ gmail com.

When this user changes his password for the first time Owncloud tries to send a mail via Yandex but sending as owncloud-user @ gmail com. Yandex rejects this for security/anti fishing purposes as it is not an alias of the admin mail address…
Is there no way to make Owncloud send all mails as owncloud-admin @ yandex com?

Sorry for the strange mail address format, I am not allowed to post multiple links yet

Yeah, my question was have you tried registering gmail as your SMTP sender? :slight_smile:

I will try this later…

But also why is it intended to not send all system messages via the administrative mail address and instead use an address you don’t even own? I mean I would be pleased if anyone could send mails in my name…

Okay I just tried and I have managed to get it working.

I think I can confirm your case.

  • I enter a kerio email server to be my SMTP server for sending emails.

  • the credentials are for my owncloud admin user with a kerio email address. for example admin@kerio.com

  • then I create a new user with a gmail address. He get’s an email from admin@kerio.com to change his password.

  • Then after he changes his password, he get’s an email from him to him, exactly from gmail to gmail that the password has changed.

I suppose there is where yandex refuses the service.

We found the bug.

You have 2 options now, either to use our fix and fix it in your current version ( 10.0.10) or you could wait for 10.0.11 where the fix is included.

The fix is:

Change this:

File: settings/Controller/UsersController.php

Line 716

It says:

$message->setFrom([$email => $this->defaults->getName()]);

Should say:

$message->setFrom([$this->fromMailAddress => $this->defaults->getName()]);

1 Like

Exactly and this is the point which I do not understand why this happens…

I think that Yandex has every right to refuse this as it is an important impact on reliance…

I just manage to “dirtily” solve it on a test server by hardcoring the administrative mail address into Usterscontroller.php

Edit: Just saw your reply, will try this out

Thanks a lot for helping me out with this issue!!!:smiley: