Author Topic: Roucube 1.2.3 with Virtualmin breaking smtp_server strings  (Read 2602 times)

Offline plouro

  • Newbie
  • *
  • Posts: 4
Roucube 1.2.3 with Virtualmin breaking smtp_server strings
« on: March 02, 2017, 10:51:40 AM »
Hello all,

I'm testing a roundcube with virtualmin, and it breaks the string passed down on $config['smtp_server'].

IMAP work greats, only SMTP.

I will try to expose the most about my configuration and what troubleshoot i did.

I have a fully working roundcube whit this settings wihout virtualmin installed.

$config['default_host'] = array(
        'mailserver 1' => 'Webmail 1',
        'mailserver 2' => 'Webmail 2',
);

$config['mail_domain'] = '%d';
$config['smtp_server'] = 'mail.%t';
$config['smtp_port'] = '25';
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = '';

Why this configuration, because i have two mail servers, and the authentication of the users is via user.domain instead user@domain.
What I'm doing here since I have clientes connecting to two different servers, is populating each client smtp server settings with mail.domain.


Now when I install a roundcube alongside virtualmin, all up to date, centos 7 x64 and try to send and email I get this error SMTP Error (-1): Connection to server failed.


So i think and still do it has to be with DNS, and that the named(BIND) service was the culprit so i disabled it.
Manually identified the nameservers in /etc/resolv.conf to Google and made sure that if i nslookup my mail server it resolved.

Now the strange thing begins to happen, if SMTP_SERVER is configured like this $config['smtp_server'] = 'mail.%t'; or %n or %t it always gives the SMTP ERROR(-1).

But if i configure directly with hostname or IP address I can send emails.

Here are the logs, about the error, noticed too that it points to rcube.php line 1648.

[02-Mar-2017 15:26:45 ERROR: Failed to connect socket: php_network_getaddresses: getaddrinfo failed: Name or service not known ()
[02-Mar-2017 15:26:45 : <sevj8rco> SMTP Error: Connection failed: Failed to connect socket: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/webmail/public_html/program/lib/Roundcube/rcube.php on line 1648 (POST /?_task=mail&_unlock=loading1488468406013&_lang=en_GB&_framed=1&_action=send)

Which points to this:
 // log error
            if (!$sent) {
                self::raise_error(array('code' => 800, 'type' => 'smtp',
                    'line' => __LINE__, 'file' => __FILE__,
                    'message' => join("\n", $response)), true, false);




Here is the header from google, verifying my user has a permitted sender, which is the expected output.

Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of ............... as permitted sender)


Please advise,

Thank you.


Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,855
Re: Roucube 1.2.3 with Virtualmin breaking smtp_server strings
« Reply #1 on: March 03, 2017, 02:43:30 AM »
and what is the server name you are using? you do not have to say the exact one but the format of it so that we can see what %n and %t would resolve to.

for example if its webmail.mysite.com then %n = webmail.mysite.com and %t = mysite.com

Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦