Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$config['smtp_host'] appears to have been replaced with $config['smtp_server'] #9780

Closed
2 tasks done
sjcrookes opened this issue Feb 18, 2025 · 1 comment
Closed
2 tasks done

Comments

@sjcrookes
Copy link

Prerequisites

  • I have searched for duplicate or closed issues
  • I can recreate the issue with all plugins disabled

Describe the issue

I'm using 1.5.9 LTS and have found that TLS configuration is taken from $config['smtp_server'], and that $config['smtp_host'] is not a valid configuration option.

In my case I ran tcpdump and saw that connections were defaulting to localhost rather than the host I specified in $config['smtp_host'], and weren't using STARTTLS because of it, which makes sense if you look at the code.

Here program/lib/Roundcube/rcube_smtp.php:91

        $smtp_host = rcube_utils::parse_host($CONFIG['smtp_server']);
        // when called from Installer it's possible to have empty $smtp_host here
        if (!$smtp_host) $smtp_host = 'localhost';

You see that $smtp_host is a local variable set by rcube_utils::parse_host on $config['smtp_server']

And here program/lib/Roundcube/rcube_smtp.php:108

        // remove TLS prefix and set flag for use in Net_SMTP::auth()
        $use_tls = false;
        if (preg_match('#^tls://#i', $smtp_host)) {
            $smtp_host = preg_replace('#^tls://#i', '', $smtp_host);
            $use_tls   = true;
        }

So my $config['smtp_host'] config entry was just ignored and instead defaulted to localhost, which was actually a valid host listening on port 587, which led to things partially working, except that STARTTLS wasn't working.

I simply fixed my problem by using the $config['smtp_server'] configuration option instead. Even though this doesn't exist in the example configurations.

The example configurations and defaults still point to $config['smtp_host'], which does not appear to be correct.
config/config.inc.php.sample
config/defaults.inc.php

...
$config['smtp_host'] = 'localhost:587';
...

I believe the documentation needs updating, and this might help a few other people with similar issues I've seen.

What browser(s) are you seeing the problem on?

Chrome

What version of PHP are you using?

8.3

What version of Roundcube are you using?

1.5.9

JavaScript errors

No response

PHP errors

No response

@sjcrookes
Copy link
Author

My bad, it seems the config parameter changed in a newer version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant