Cannot send emails via Roundcube

Discussion in 'ISPConfig 3 Priority Support' started by philgardner, Jun 28, 2018.

  1. philgardner

    philgardner Member

    Server: Ubuntu 18.04 (64-bit)
    ISPConfig 3.12 installed according to the Perfect Server tutorial (MariaDB, Apache, Postfix, Dovecot)
    Roundcube 1.3.6 with active plugins 'acl', 'help', 'new_user_identity', 'additional_message_headers', 'http_authentication', 'password', 'database_attachments', 'jqueryui', 'squirrelmail_usercopy', 'emoticons', 'managesieve', 'zipdownload', 'enigma', 'newmail_notifier'.

    Roundcube works perfectly for receiving messages via IMAP, but when I try to send messages I get the error 'SMTP Error (220): Authentication failed.' Sending messages works fine via my email client (Thunderbird) set up to use port 587 and STARTTLS.

    The Roundcube SMTP log looks like this (I have extracted just one attempt, as they are all the same):
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 220 server2a.pangolin-cs.co.uk ESMTP Postfix (Ubuntu)
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Send: EHLO server2a.pangolin-cs.co.uk
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-server2a.pangolin-cs.co.uk
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-PIPELINING
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-SIZE
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-VRFY
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-ETRN
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-STARTTLS
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-ENHANCEDSTATUSCODES
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-8BITMIME
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250-DSN
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 250 SMTPUTF8
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Send: STARTTLS
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Recv: 220 2.0.0 Ready to start TLS
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Send: RSET
    [28-Jun-2018 13:29:24 +0300]: <aj9pcrsi> Send: QUIT

    I have tried to solve this by following the instructions in various online posts, but without success, so I am asking for urgent help here – hope that's okay.

    I am attaching the roundcube configuration files defaults.inc.php and config.inc.php (with .txt extension added so they can be uploaded).

    Thank you!
    Phil Gardner
     

    Attached Files:

    fesfo likes this.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is roundcube installed on the mail server?
     
  3. philgardner

    philgardner Member

    Yes, it's a single-server setup.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Then there is no need to enable TLS at all as the emails are not going over an external network. I recommend to change back the settings to the original ones from the perfect server tutorial.
     
  5. philgardner

    philgardner Member

    Ah, I see! Right, I'll do that. Thank you.
     
  6. philgardner

    philgardner Member

    I purged roundcube* and then reinstalled it and configured it as instructed in the Perfect Server tutorial. I then re-downloaded the latest ISPConfig and ran php update.php.

    Now I get a slightly different error when I try to send a message from Roundcube: 'SMTP Error (250): Authentication failed."

    And, alas, now I can't log in to the ISPConfig control panel – when I enter the admin username and password it sends me straight back to the login screen (without any errors).
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Check if mysql / mariadb is running. Regarding smtp error, take a llo at the postfix master.cf file, there shall be no # in front of the smtps and the submission lines.
     
  8. philgardner

    philgardner Member

    Yes, mysql is running. And the master.cf settings are correct – if they had not been correct, I wouldn't be able to send via an email client. The smtp problem is Roundcube only.

    I have of course tried rebooting the server, but this makes no difference.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Not really, if they would be incorrect, then you can send with a normal client but not Roundcube, that's why I ask. Please post the postfix master.cf file.

    and post the output of:

    ps aux | grep mysql
     
  10. philgardner

    philgardner Member

    Oh, sorry – I still have a lot to learn! The output of ps aux | grep mysql is:

    mysql 1291 0.2 10.9 753044 166496 ? Ssl 16:36 0:09 /usr/sbin/mysqld
    root 7810 0.0 0.0 14428 1044 pts/0 S+ 17:55 0:00 grep --color=auto mysql

    I am attaching master.cf (as master.cf.txt).
     

    Attached Files:

  11. philgardner

    philgardner Member

    The Control Panel problem turned out to be browser-related. After clearing cookies and local storage I was able to log in successfully. However, the roundcube problem remains.
     
  12. philgardner

    philgardner Member

    I have now solved it. The default version of config.inc.php that comes with the version of Roundcube in Ubuntu 18.04 contains the lines:

    $config['smtp_user'] = '%u';
    $config['smtp_pass'] = '%p';

    I changed these to:

    $config['smtp_user'] = '';
    $config['smtp_pass'] = '';

    ... and I can now send emails from Roundcube!

    Please add this as an instruction in the Perfect Server tutorial, to avoid other users having to struggle with this issue. It might also be worth saying explicitly that no smtp authorization is needed in Roundcube, as I suspect others may well think, as I did, that it should be used.

    With thanks and best wishes,
    Phil
     
    Dalibor Klobučarić and ahrasis like this.
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    I have a server with the exact result of the perfect server setup Ubuntu 18.04 here and the Roundcube login works flawlessly, no changes are required besides what's described in the tutorial.

    From my working Roundcube config:

    Code:
    // The IMAP host chosen to perform the log-in.
    // Leave blank to show a textbox at login, give a list of hosts
    // to display a pulldown menu or set one host as string.
    // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
    // Supported replacement variables:
    // %n - hostname ($_SERVER['SERVER_NAME'])
    // %t - hostname without the first part
    // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
    // %s - domain name after the '@' from e-mail address provided at login screen
    // For example %n = mail.domain.tld, %t = domain.tld
    $config['default_host'] = 'localhost';
    
    // SMTP server host (for sending mails).
    // Enter hostname with prefix tls:// to use STARTTLS, or use
    // prefix ssl:// to use the deprecated SSL over SMTP (aka SMTPS)
    // Supported replacement variables:
    // %h - user's IMAP hostname
    // %n - hostname ($_SERVER['SERVER_NAME'])
    // %t - hostname without the first part
    // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
    // %z - IMAP domain (IMAP hostname without the first part)
    // For example %n = mail.domain.tld, %t = domain.tld
    $config['smtp_server'] = 'localhost';
    
    // SMTP port (default is 25; use 587 for STARTTLS or 465 for the
    // deprecated SSL over SMTP (aka SMTPS))
    $config['smtp_port'] = 25;
    
    // SMTP username (if required) if you use %u as the username Roundcube
    // will use the current username for login
    $config['smtp_user'] = '%u';
    
    // SMTP password (if required) if you use %p as the password Roundcube
    // will use the current user's password for login
    $config['smtp_pass'] = '%p';
    On localhost, smtp auth is not required, but it does not matter if you use it as you can use smtp-auth on localhost but you don't have to. So I can only guess that an other change that you made to your setup must cause the issue on your server.
     
  14. Steinbruch

    Steinbruch Member HowtoForge Supporter

    Since this made me curious I took a look at my Debian roundcube install (all per Perfect Server tutorial) and it doesn't have smtp_user and smtp_pass populated in the way Ubuntu seems to have it. In our distributed setup we run roundcube off of the mail servers (I have even given them webserver config for the purpose of using LetsEncrypt - hoping I can figure out to use the same cert for both the SSL access to roundcube and the postfix and dovecot connections) - just my 2 cents, really.
     

Share This Page