Mail Client AutoConfiguration - $SMTP_LOGIN does not use correct username

When configuring an email account using mail autoconfig, the variable $SMTP_LOGIN should be replaced by the default Virtualmin username, name.domain, however it is currently just replaced by name

Status: 
Fixed (pending)

Comments

pixel_paul's picture
Submitted by pixel_paul on Thu, 11/16/2017 - 05:30 Pro Licensee

Title: Mail Client AutoConfiguration - $SMTP_LOGIN does not user correct username ยป Mail Client AutoConfiguration - $SMTP_LOGIN does not use correct username

Howdy -- thanks for contacting us!

We just wanted to verify -- are you seeing that same issue with email accounts, in addition to Virtual Server owners?

That is, it's normal for Virtual Server owners to have an account with just the "name".

By default, only email accounts use name.domain.

But if you're seeing that issue with email accounts as well, we'd need to dig deeper into that.

pixel_paul's picture
Submitted by pixel_paul on Thu, 11/16/2017 - 09:49 Pro Licensee

This is occurring when configuring a standard user email account.

Thanks,

Paul

Can you post the contents of the cgi-bin/autoconfig.cgi script under this domain's home directory (or at least the $STYLE and $USER lines) ?

I have almost the same issue. When I set up an account in Thunderbird and other clients, it gets the username is returned without the domain, so instead of "fred@domain.com", it just inserts "fred". On my server the username format to check email is "fred@domain.com". What can I do to fix this?

Ilia's picture
Submitted by Ilia on Mon, 11/23/2020 - 06:14

I have almost the same issue. When I set up an account in Thunderbird and other clients, it gets the username is returned without the domain, so instead

I think the issue for you (and some other folks) happen because /home/domain.com/cgi-bin/autoconfig.cgi file is not automatically updated if it already exists.

The workaround would be is to manually delete that ~/cgi-bin/autoconfig.cgi file in domain's home and then toggle (disable and right afterwards enable) mail client autoconfiguration on Email Settings > Mail Client Configuration page or simply re-run config check.

I have taken a deeper look into it actually, and can confirm that there is no bug in there with latest Virtualmin 6.13+. Mail Client Configuration script returns a username based on email provided - when a domain owner uses its account to connect, then ~/cgi-bin/autoconfig.cgi also returns the right values for username (without @), port, hostname and etc, just as for the additional mail users, which username must contain @.

Jamie, should we improve this and have it automatically regenerated upon toggling Mail Client Configuration option or re-running config check? Because right now, it only fixes variables placed at the top of the ~/cgi-bin/autoconfig.cgi file and not the code itself?

Is the change that triggers this problem switching between different username formats?

I suppose we could re-generate autoconfig.cgi in that case - however, this does run the risk that users created before changing the username format will now be handled incorrectly.

Ilia's picture
Submitted by Ilia on Mon, 11/23/2020 - 16:53

Is the change that triggers this problem switching between different username formats?

At the moment all is working just fine! Presumably, the failure could happen if a domain was created many years ago, at the times where this feature had bugs.

I suppose we could re-generate autoconfig.cgi in that case - however, this does run the risk that users created before changing the username format will now be handled incorrectly.

Well, considering the current code for autoconfig.cgi it wouldn't be a problem. It will automatically provide correct date for XML file. Right?

Again, I couldn't reproduce the problem. I ran quick tests and noticed that variables at the top of autoconfig.cgi are updated with correct values, however the code below (logic) doesn't. I made an assumption that the user which is having a problem, stuck with a very-very old version of autoconfig.cgi, which didn't handle it correctly some time in the past.

So my question and suggestion - would that be a good idea to update not only variables in autoconfig.cgi file but also the whole file, upon config check?

Agreed - we could check after each new install if autoconfig.cgi is out of date, and if so update it to the latest version with the correct substitutions. I'll put this on my TODO list ..

Ok, re-generating the config on upgrade has been implemented for inclusion in the next release.

Ilia's picture
Submitted by Ilia on Wed, 12/09/2020 - 04:57

Ok, re-generating the config on upgrade has been implemented for inclusion in the next release.

Superb, thanks Jamie!