On Sun, 25 Sep 2022 14:58:20 +0200 I wrote:
Hi,
I am using Roundcube for webmail users, version 1.6.0 at the moment. I'd like to use one instance for more domains, i.e., user1@domain1, user2@domain2, etc. As mail servers for domains allowed may differ, I am using simple pattern - mail.domain for IMAP and smtp.domain for SMTP. This, translated into config, is
$config['imap_host'] = 'tls://mail.%s:143'; $config['smtp_host'] = 'tls://smtp.%s:587';
Nice, simple, but... not working. To be precise, IMAP host used for login and mail message retrieval works well, SMTP host used for mail sending does not work. If I put name without %s there, everything is OK, but not universal, limiting full usage only for users in that domain.
Is there anything I can try? Any (known) way to debug?
By the way, error message is 'SMTP Error (): Connection to server failed'. In smtp.log, there is 'Connecting to localhost:587...' line, which means smtp.%s somehow turns into localhost, where nothing listens on port 587. Why? Is there any workaround? Patch to test?
[ Follow-up to my mail ]
Hi,
there was no reply on users mailing list, I am trying on dev this time.
For the time being, I switched to use %d in my config, which is a workaround, or partial solution for me. It does not exactly what I want, but at least partially it works for users.
I tried looking a bit in sources, probably function parse_host in rcube_utils.php is the culprit, or this usage was not tested and some bug is not discovered. I added some debug there, namely (intentionaly not formatted, a bit hackish, but nevertheless...)
$s = '';
if (strpos($name, '%s') !== false) {
$user_email = self::idn_to_ascii(self::get_input_value('_user', self::INPUT_POST));
system('echo parse_host :' . json_encode(self::INPUT_POST) . ': :' . json_encode(self::get_input_value('_user',self::INPUT_POST)) . ': :' . json_encode($user_email) . ':>>/tmp/debug'); $matches = preg_match('/(.*)@([a-z0-9.-[]:]+)/i', $user_email, $s); if ($matches < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false) { return false; } $s = $s[2]; }
When imap_host is being processed, line added into /tmp/debug file is
parse_host :2: :user@domain: :user@domain:
where user@domain is address used for login, whereas when smtp_host is being processed, this line is different,
parse_host :2: :null: :null:
so this suggests user login address is somehow not available at the moment smtp_host is parsed.
I can't find anything more at the moment, no clue how to fix the issue. Could someone help me?
Regards, Milan