SMTP error (535): Authorization error

Issue #40 closed
Артем Станиславенко created an issue

Hello. It gives an error SMTP error (535): Authorization error. I have already seen questions with this problem, but I have the latest version installed, it should work. Initially, this plugin worked, but recently began to display this error. The error is triggered when trying to send a message from a connected user. Tell me what could be the problem?

Comments (21)

  1. Zach Poff

    I’m encountering a similar thing with Roundcube 1.4-rc1 & ident_switch 4.0.1:

    1. Roundcube works fine with the primary identity.
    2. Installed ident_switch and ran SQL
    3. Setup a second identity with ident_switch (different domain) and switched to it.
    4. IMAP fetches OK, but SMTP fails (SMTP Error (535): Authentication failed.)

    The logs indicate that roundcube is authenticating against the secondary identity’s server (as it should be) but it is using the username from the primary identity. (I checked the db and the credentials are stored correctly.)

    It’s somewhat unclear to me how ident_switch interacts with RC’s main IMAP/SMTP config, but here are some relevant lines from mine:$config['smtp_server'] = '%h';
    $config['smtp_port'] = 587;
    $config['smtp_user'] = '%u';
    $config['smtp_pass'] = '%p';

    Note: If I hardcode identity 2’s username in $config['smtp_user'] then SMTP works for identity 2, but I don’t need to hardcode the password. It seems like ident_switch is fetching the password from the db, but pulling the username directly from the config file?

  2. Boris Gulay repo owner

    Hello @Zach Poff .

    Looks like you have outdated version. Lines you copied here looks like this in repo:

    $args['smtp_user'] = $r['username'];

    $args['smtp_pass'] = $rc->decrypt($r['password']);

    $args['smtp_server'] = $r['smtp_host'] ? $r['smtp_host'] : 'localhost'; // Default SMTP host here

    $args['smtp_port'] = $r['smtp_port'] ? $r['smtp_port'] : 587; // Default SMTP port here

    I have changed the code to fix problem you are talking about. Try latest plugin version please.

  3. Zach Poff

    Sorry, my writing was confusing. The lines I copied were from Roundcube’s config.inc.php, not from ident_switch.

    I’m running the plugin version 4.0.1, which seems current. In ident_switch.log I can see that the plugin is pulling the correct username from the db when I switch to the identity, but when I send mail it is using the username from my primary identity for the SMTP conversation.

    Any ideas or further diagnostic steps?

  4. Boris Gulay repo owner

    It was some fixes after 4.0.1. I’ve just released version 4.1. Please update.

    If it will not help, we will continue investigation.

  5. Zach Poff

    Thank you very much for the update. It doesn’t change the behavior though. I have noticed that this line in the ident_switch log:

    Switching mailbox to one for identity with ID ....

    always shows the correct username when I switch to the identity, but that username is not being used in the actual SMTP request. (It’s always the username from my main Roundcube identity.)

    I can insert some debug logging somewhere if it will help.

  6. Nico Domino

    I also updated to 4.1 and am still not able to send from the second identity. Still receiving the aforementioned SMTP Auth error.

  7. Zach Poff

    Just a note that this problem still exists with ident_switch 4.1 (last commit 2019‑09‑04) and Roundcube 1.4-rc2. Unfortunately there is no way to send emails with ident_switch identities until the issue is addressed. Let me know if I can help. (I have a rudimentary familiarity with php so I haven’t been able to solve it myself but I can add some logging and provide results as needed.)

  8. Boris Gulay repo owner

    I’ve checked how roundcube is connecting to another server (server of another identity). It’s using right username and password.

    Can you please check that ient_switch table in your DB has smtp_host column and ident_switch.php is up to date?

    It would be goo is you can show me contents of your ident_switch table. Please use direct message or my email, do not post contents here. Alse please change passwords to anything you want. Only empty/not empty and IDs are important.

  9. Zach Poff

    Hello Boris. Sorry for the late reply. Table looks good to me and ident_switch.php is most recent version. I have the sql for you but I don’t see any option in Bitbucket to send a DM or email. Sorry if I' missing something obvious! (Also I just updated to RC 1.4.0 and the problem persists)

  10. Dennis U.

    Confirm. Had this issue for roundcube 1.3.8 as well as for 1.4.0, now. Ident_switch is up to date.

    mysql> SELECT * FROM ident_switch;
    +----+---------+-----+--------------+----------------------------------+--------------+-----------+--------------------+-------+--------------+-----------+
    | id | user_id | iid | username     | password                         | imap_host    | imap_port | label              | flags | smtp_host    | smtp_port |
    +----+---------+-----+--------------+----------------------------------+--------------+-----------+--------------------+-------+--------------+-----------+
    |  1 |       1 |   2 | u7469        | **********puE6gVzmFI5D3UsTznvWPn | imap.****.de |       143 | du@**********.de   |     5 | smtp.****.de |       465 |
    |  2 |       1 |   4 | u7469        | **********Mev7bsEfLi1cknv1iFnpqK | imap.****.de |       143 | info@**********.de |     5 | smtp.****.de |       465 |
    +----+---------+-----+--------------+----------------------------------+--------------+-----------+--------------------+-------+--------------+-----------+
    2 rows in set (0.01 sec)
    

  11. Boris Gulay repo owner

    @Zach Poff just post it here like Dennis does.

    Guys, it will take some time to investigate. Will return to you at the middle of next week.

  12. Zach Poff

    +----+---------+-----+--------------+-----------+-----------------------+-----------+-----------+-------+--------------------+-----------+
    | id | user_id | iid | username     | password  | imap_host             | imap_port | label     | flags | smtp_host          | smtp_port |
    +----+---------+-----+--------------+-----------+-----------------------+-----------+-----------+-------+--------------------+-----------+
    |  4 |       3 |   8 | **@****.edu  | ********* | outlook.office365.com |       993 | mylabel   |     5 | smtp.office365.com |       587 |
    +----+---------+-----+--------------+-----------+-----------------------+-----------+-----------+-------+--------------------+-----------+
    

  13. Log in to comment