mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
email: Implement auto-discovery
This commit is contained in:
parent
355cc84a1b
commit
cdfef82bf6
@ -24,3 +24,18 @@
|
||||
TKTAuthToken "admin"
|
||||
</IfModule>
|
||||
</Location>
|
||||
|
||||
<Location "/plinth/apps/email_server/*.xml">
|
||||
# Require SSO
|
||||
Include includes/freedombox-single-sign-on.conf
|
||||
<IfModule mod_auth_pubtkt.c>
|
||||
TKTAuthToken "admin"
|
||||
</IfModule>
|
||||
</Location>
|
||||
|
||||
<Location "/.well-known/autoconfig/mail/config-v1.1.xml">
|
||||
ProxyPass http://127.0.0.1:8000/plinth/apps/email_server/config.xml
|
||||
RequestHeader unset Cookie
|
||||
Header unset Set-Cookie
|
||||
Include includes/freedombox-robots.conf
|
||||
</Location>
|
||||
|
||||
22
plinth/modules/email_server/templates/config.xml
Normal file
22
plinth/modules/email_server/templates/config.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<clientConfig version="1.1">
|
||||
<emailProvider id="{{ host }}">
|
||||
<domain>{{ host }}</domain>
|
||||
<displayName>FreedomBox Mail</displayName>
|
||||
<displayShortName>FBXMail</displayShortName>
|
||||
<incomingServer type="imap">
|
||||
<hostname>{{ host }}</hostname>
|
||||
<port>993</port>
|
||||
<socketType>SSL</socketType>
|
||||
<username>%EMAILLOCALPART%</username>
|
||||
<authentication>password-cleartext</authentication>
|
||||
</incomingServer>
|
||||
<outgoingServer type="smtp">
|
||||
<hostname>{{ host }}</hostname>
|
||||
<port>465</port>
|
||||
<socketType>SSL</socketType>
|
||||
<username>%EMAILLOCALPART%</username>
|
||||
<authentication>password-cleartext</authentication>
|
||||
</outgoingServer>
|
||||
</emailProvider>
|
||||
</clientConfig>
|
||||
@ -1,6 +1,7 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
from django.urls import path
|
||||
from plinth.utils import non_admin_view
|
||||
from stronghold.decorators import public
|
||||
from . import views
|
||||
|
||||
|
||||
@ -13,4 +14,6 @@ urlpatterns = [
|
||||
non_admin_view(views.MyMailView.as_view()), name='my_mail'),
|
||||
path('apps/email_server/my_aliases',
|
||||
non_admin_view(views.AliasView.as_view())),
|
||||
|
||||
path('apps/email_server/config.xml', public(views.XmlView.as_view())),
|
||||
]
|
||||
|
||||
@ -273,3 +273,18 @@ class DomainView(TabMixin, TemplateView):
|
||||
changed[key] = value
|
||||
audit.domain.set_keys(changed)
|
||||
return self.render_to_response(self.get_context_data())
|
||||
|
||||
|
||||
class XmlView(TemplateView):
|
||||
template_name = 'config.xml'
|
||||
|
||||
def render_to_response(self, *args, **kwargs):
|
||||
if 200 <= kwargs.get('status', 200) < 300:
|
||||
kwargs['content_type'] = 'text/xml; charset=utf-8'
|
||||
response = super().render_to_response(*args, **kwargs)
|
||||
return response
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['host'] = self.request.get_host()
|
||||
return context
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user