Skip to content

Updated autoconfig file to include POP3 and CardDAV/CalDAV #2499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tdulcet
Copy link
Contributor

@tdulcet tdulcet commented Apr 4, 2025

For reference, the autoconfig file format is documented here. There is also a draft specification here.

Copy link

@benbucksch benbucksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, other than the display name change.

<displayName>PRIMARY_HOSTNAME (Mail-in-a-Box)</displayName>
<displayShortName>PRIMARY_HOSTNAME</displayShortName>
<displayName>%EMAILDOMAIN% (Mail-in-a-Box)</displayName>
<displayShortName>%EMAILDOMAIN%</displayShortName>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use placeholders in the display name. Not all clients implement placeholders in all fields.

Copy link

@benbucksch benbucksch Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the server insert the correct value here, given that it generates the file and supports server-side placeholders anyways? This may need to be a new server-side placeholder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, see #954. Mail-in-a-Box uses a single config file for all domains. The PRIMARY_HOSTNAME placeholder is replaced at install time, so for example if the user's primary domain is example.com, but they also are hosting example.net and example.org, the PRIMARY_HOSTNAME placeholder would be replaced with box.example.com:

mailinabox/setup/web.sh

Lines 115 to 123 in 3efd425

# Create the Mozilla Auto-configuration file which is exposed via the
# nginx configuration at /.well-known/autoconfig/mail/config-v1.1.xml.
# The format of the file is documented at:
# https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
# and https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo.
cat conf/mozilla-autoconfig.xml \
| sed "s/PRIMARY_HOSTNAME/$PRIMARY_HOSTNAME/" \
> /var/lib/mailinabox/mozilla-autoconfig.xml
chmod a+r /var/lib/mailinabox/mozilla-autoconfig.xml
This is obviously confusing for the user when they are setting up an example.net or example.org e-mail address, especially when they have multiple addresses, as they all show as box.example.com in their e-mail client's UI.

Copy link

@benbucksch benbucksch Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this change was removed in the last version? It re-appeared.

Given that this is a breaking change for some clients, could you please move this to a new PR and reference the new PR number here? Then we can investigate that issue there in the new PR, and the rest here can land already. All the rest is OK, from what I can see.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing has been changed yet in regard to this. This config file is primarily for Thunderbird (hence the filename mozilla-autoconfig.xml) and as you know, Thunderbird does support placeholders in the display name. A couple of existing config files in the ISPDB already use placeholders in the display name and your draft specification also mentions the possibility in section 3.8:

Some clients MAY also support the same placeholders for the fields <hostname>, <url>, <authURL>, <tokenURL>, <issuer>, <displayName> and <displayShortName>.

I can remove the change from this PR. However, it may be a while until this PR is merged, so there should be plenty of time to do any needed investigations... I have several pending PRs I am waiting on, including #1455 and #2473.

Copy link

@benbucksch benbucksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more small change, and it's OK.

<displayName>PRIMARY_HOSTNAME (Mail-in-a-Box)</displayName>
<displayShortName>PRIMARY_HOSTNAME</displayShortName>
<displayName>%EMAILDOMAIN% (Mail-in-a-Box)</displayName>
<displayShortName>%EMAILDOMAIN%</displayShortName>
Copy link

@benbucksch benbucksch Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this change was removed in the last version? It re-appeared.

Given that this is a breaking change for some clients, could you please move this to a new PR and reference the new PR number here? Then we can investigate that issue there in the new PR, and the rest here can land already. All the rest is OK, from what I can see.

Co-Authored-By: Ben Bucksch <1907525+benbucksch@users.noreply.github.com>
Copy link

@benbucksch benbucksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
All OK for me.

Comment on lines +50 to +51
<!-- Redirects to: https://PRIMARY_HOSTNAME/cloud/remote.php/caldav/ -->
<url>https://PRIMARY_HOSTNAME/.well-known/caldav</url>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a choice, whether you want to put the well-known URL in the config (advantage: more stable, disadvantage: slower, because 1 more redirect), or the actual URL. Both is OK, as long as you understand the implications.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern with using the actual URL is that it could change in a future Nextcloud (or Mail in a Box) update and someone may forget to update this config file, but I would be fine with going either way.

Copy link

@benbucksch benbucksch Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guessed so. Note that clients will save the URL once configured, so even if you update the config file, the clients will not update it, so you essentially cannot ever change the URL.

You could redirect the old to the new URL, if you need to change it, which is no worse than the redirect now.

I'm also fine either way, as long as the consequences are understood. I leave it to the maintainers of mail-in-a-box, because they'll have to maintain it.

@benbucksch
Copy link

Ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants