Currently, we have a fully working POP/IMAP/Webmail system (using Dovecot and Roundcube) that is a gleaming tower of perfection in its intended design. We have thousands of customers who belong to a "default" domain (I'll call it ourdomain.com), and successfully log in with a username and password. We have a few thousand more who own domains that we host, and they log in successfully with their full e-mail address and password (call it customerdomain.com). It's been this way since the 1990s, with a lot of entrenched customer configuration.
The problem is now that people are used to logging into web forms with a full e-mail address, people who use ourdomain.com have to be reminded to log into webmail using only their username. This is a call our tech support department gets several times a week (and even I am guilty of doing this, I just don't call tech support about it), and probably should be eliminated with some kind of software solution.
So how do we get either Roundcube or Dovecot to recognise "[email protected]" as "username" instead, without having to change everyone's actual username in our system? But only do that if the domain is "ourdomain.com" and not "customerdomain.com". Keep in mind that any custom coding we do will have to be re-implemented every time we do security upgrades, and we would only consider that option as the last possible choice.
TL;DR:
We need this logic:
if $email contains @ourdomain.com
{
remove @ourdomain.com;
submit to roundcube;
} else {
submit to roundcube;
}
This problem can be tackled either in roundcube, dovecot or your username-backend.
Roundcube has option to auto append domain parts if no domain provided (as proposed by Kondybas). But it won't too useful in your case. Of course you can patch roundcube (with PHP language) to adding your logic.
Dovecot has option to strip domain (as proposed in Dovecot user lookup fails when using username@domain format) but it can't do conditional stripping (e.g. strip domain if domain = @ourdomain.com). Of course you can patch dovecot (with C language) to adding your logic.
Username-backend is also option too. You don't give the backend you use (either SQL, LDAP, custom engine). I can imagine that you have username column that have two format with and without domain. Now, you can convert all username without domain become username@ourdomain. You can combine this process with option 1 (roundcube auto append domain) so either username and username@ourdomain can login.
RoundCube
have an option calledusername_domain
If you have used subdirectory (like
ourdomain.tld/roundcube
) set this option to theIf you have used subdomains (like
mail.domain.tld
) set this option to theWhen user provide his full email as login, that email will be used without any changes. If domain part is omitted,
RoundCube
will use the URL-domain for completion. Also there is number of neat options in the roundcube's config.