Main account issue in roundcube webmail

Richard G

Verified User
Joined
Jul 6, 2008
Messages
14,011
Location
Maastricht
I've tried to search but could not find a good solution.

This is the problem.
I got a main user account, named for example james.
The email address would be then [email protected] and is working fine when using a mail client.
Second address is for example [email protected] and is also working fine using a mail client.

Now when using Roundcube webmail, the mail is working fine for [email protected] because I have to login using [email protected] as username.

This does not work for main accounts. When using [email protected] the system keeps telling me I'm using wrong username/password.
When logging with just "james" as name, I can login.
Receiving mail is no problem.

However, when sending mail, the mail will be send as james@localhost instead of [email protected].

I can understand this, because you don't login with your complete email address. Does this mean you never can use the main account name on webmail? Or is there a fix for this, so mail will be send out as [email protected] instead of james@localhost?

Because many mailservers will reject mail from external @localhost adresses.

It seems this can be changed in the settings after loggin in as james, but I need a server-wide solution, so for all users for this.
 
Try re-configure /var/www/html/roundcube/config/main.inc.php. Perhaps this should be changed into something more dynamic and meaningful:

Code:
// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %d = domain.tld
$rcmail_config['smtp_server'] = ;

If every user uses roundcube on his own domain, than you can try change localhost into %n.


Please, update us with results.

Note, changes will be lost with roundcube update.
 
Thanks for the quick reply.

I used %d because an email address normaly is [email protected] and not [email protected] and it seems to work.

However, in this case it seems that everyone would have that problem. There should be a way to fix this definately so it won't get deleted again after an update.
Has DA never thought of this?
 
I just wrote him. Maybe he will take a look.
I don't know if this is good for everybody, because I made the necessary changes that users are visiting the webmail via http://domain.tld/webmail and I don't know for sure if the %d will also work for standard custombuild configs.
 
No, but I might try that tonight, but I don't think that would make any difference when using another domains url to login.
When the variable %n gives the wrong hostname, so will the others.

The %n will give the http hostname, which is also different from the users domain name. That might work, but is not the correct solution. The correct solution is that for every user the users domain name is used, no matter which domain url he is using to login to his webmail.

Or there should be an option that for email the user is obligated to login with the full email adres, just like with their other email accounts.
However, this is not allowd by roundcube.
 
Default email account (login into Directadmin) is a system account, which is not associated with any domain on a server, but hostname. It's not a virtual email account. That's the reason, I think. Thus roundcube does not know, what domain to use, if you do not specified any. To use real hostname in this case is much more logical to my mind, than localhost. At least, you have a chance to get a reply on your email. With localhost, no reply will ever come from your "pen friend".
 
It's not a virtual email account. That's the reason, I think.
Indeed it's a system account, but is reachable by email, so is also email account. System emails get into there too.
It seems DA is making a combination of system and virtual accounts.
Squirrelmail has no problems with that. Roundcube has. So looking at it that way, it would be that Roundcube only supports virtual email accounts or has problems with the combination of system and virtual email.

With localhost, there will also be no reply's logically, only direct mail. Gmail is accepting the mail, we tested that. It seems that only the return-path is set to user@localhost, but the mail will be send via the hostingproviders hostname, using the users domain as helo, even without the %n parameter as you can see in the test header below.

Delivered-To: [email protected]
Received: by 10.142.58.4 with SMTP id g4cs276222wfa;
Sat, 22 Jan 2011 09:11:26 -0800 (PST)
Received: by 10.223.86.16 with SMTP id q16mr2138124fal.58.1295716281287;
Sat, 22 Jan 2011 09:11:21 -0800 (PST)
Return-Path: <richardg@localhost>
Received: from server.hostingdomain.com (ns1.hostingdomain.com [78.46.xx.xx])
by mx.google.com with ESMTPS id p23si10421620fak.202.2011.01.22.09.11.20
(version=TLSv1/SSLv3 cipher=RC4-MD5);
Sat, 22 Jan 2011 09:11:21 -0800 (PST)
Received-SPF: neutral (google.com: 78.46.xx.xx is neither permitted nor denied by best guess record for domain of richardg@localhost) client-ip=78.46.xx.xx;
Authentication-Results: mx.google.com; spf=neutral (google.com: 78.46.xx.xx is neither permitted nor denied by best guess record for domain of richardg@localhost) smtp.mail=richardg@localhost
Received: from localhost ([127.0.0.1] helo=www.richardg.nl)
by server.hostingdomain.com with esmtpa (Exim 4.72)
(envelope-from <richardg@localhost>)

The funny thing here, is that the helo to the external mailserver IS done with my domain name, so that is correct.
Only the from and the return-path is incorrect.

But as I said. I never had this problem with Squirrelmail before as far as I know.
 
Updating an old topic. But this problem is occuring again. I thought it was fixed? Unfortunately the problem occurs again.

From the config.inc.php
Code:
$config['smtp_server'] = 'localhost';

which should be:
Code:
$config['smtp_server'] = %d;
or '%d' to have a correct return path instead of user@localhost, which only files the mailqueue with undeliverable mail.

I know I can fix this via a custom config, but this should not be localhost by default.

What about this setting, can this remain localhost or does this need to be changed too?
Code:
$config['default_host'] = 'localhost';

Edit: I just checked and tested and smtp should be %d by default and default_host should be %t by default to have things working properly.
Can this be fixed by default please? Or is there a reason to use localhost and create errors?

Edit2: Also discovered on webmail www.domain.tld is used instead of mail.domain.tld as helo address. Seems a bug in Roundcube which says:
For example %n = mail.domain.tld
However, if you use %n it uses www.domain.tld and not mail.domain.tld how come? Or is this because of some config of DA? Because everywhere it says %n should be mail.domain.tld?
 
Last edited:
Did some more tests. The %t parameter can not be used in default_host because in that case several domains can't log in anymore.
So you have to use %n because %d and %t will mess things up too.

For the helo I found a $config['smtp_helo_host'] = ' '; setting, but this can't be used with for example %n because then it will give a 501 error.

Now then there is this (which should not be the case). When I use www.domain.com/webmail and then use credentials of [email protected] with the password belonging to that email address. I can send mail via roundcube. No problem there.
However, in that case the helo used is the helo of domain.com and not otherdomain.org. So in fact, you can spoof helo adresses.
 
I just want to mention that in the upcoming release Roundcube 1.3, it will require an SMTP server connection to send mails. Maybe that will have influence on the problem you describe? Here is from the news:

Roundcube Webmail 1.3-beta out now: https://roundcube.net/news/2017/01/05/roundcube-webmail-1.3-beta-out-now

3: requires an SMTP server connection to send mails

That last item means you need to review your SMTP server settings as described in our wiki if you have set the smtp_server option to an empty value and are thus using PHP’s mail() function.
 
This is from the wiki mentioned in your link:

Code:
$config['smtp_server'] = 'tls://%h';
where tls is if you want to use tls. The wiki also says:

or example %n = mail.domain.tld, %t = domain.tld
So I use %n, but as tested, the email still uses the domain name you are visiting as helo name and not mail.domain.tld, not even mail.domain.tld from the domain you visit. So thats not good imho.

It's a general issue. But that's part 2.

Part 1 is the default_host setting, which determines the sending email address (from address).
For $config['default_host'] according to Roundcube %t (domain.tld) should be used, but that does not work, several accounts won't be able to login then, with the error "can not make connection to server".
There should not be filled in 'localhost' by default, because then system accounts will send as user@localhost instead of [email protected], so %n is needed there. Which conflicts again with the explaination of roundcube which states that %n is mail.domain.tld so either Roundcube is doing a wrong check or DA is.

It's very odd. And it's 100% reproducable.
 
Back
Top