diff --git a/plinth/modules/email/dns.py b/plinth/modules/email/dns.py index 6491c44ef..095ea071d 100644 --- a/plinth/modules/email/dns.py +++ b/plinth/modules/email/dns.py @@ -46,9 +46,8 @@ class Entry: # pylint: disable=too-many-instance-attributes return ' '.join(pieces) -def get_entries(): - """Return the list of DNS entries to make.""" - domain = privileged.domain.get_domains()['primary_domain'] +def get_entries(domain: str) -> list[Entry]: + """Return the list of DNS entries to be set in DNS server for domain.""" mx_spam_entries = [ Entry(type_='MX', value=f'{domain}.'), Entry(type_='TXT', value='v=spf1 mx a ~all'), @@ -77,10 +76,9 @@ def get_entries(): return mx_spam_entries + dkim_entries + autoconfig_entries -def get_reverse_entries() -> list[Entry]: +def get_reverse_entries(domain: str) -> list[Entry]: """Return the list of reverse DNS entries to make.""" entries = [] - domain = privileged.domain.get_domains()['primary_domain'] for ip_type in typing.get_args(typing.Literal['ipv4', 'ipv6']): try: ip_address = lookup_public_address(ip_type) diff --git a/plinth/modules/email/templates/email-dns.html b/plinth/modules/email/templates/email-dns.html new file mode 100644 index 000000000..9ecc939b9 --- /dev/null +++ b/plinth/modules/email/templates/email-dns.html @@ -0,0 +1,95 @@ +{% extends "base.html" %} +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load i18n %} + +{% block content %} +
+ {% blocktrans trimmed %} + The following DNS records must be added manually on this domain for the + mail server to work properly for this domain. + {% endblocktrans %} +
+ +| {% trans "Domain" %} | +{% trans "TTL" %} | +{% trans "Class" %} | +{% trans "Type" %} | +{% trans "Priority" %} | +{% trans "Weight" %} | +{% trans "Port" %} | +{% trans "Host/Target/Value" %} | +
|---|---|---|---|---|---|---|---|
| {{ dns_entry.domain|default_if_none:"" }} | +{{ dns_entry.ttl }} | +{{ dns_entry.class_ }} | +{{ dns_entry.type_ }} | +{{ dns_entry.priority }} | +{{ dns_entry.weight|default_if_none:"" }} | +{{ dns_entry.port|default_if_none:"" }} | +{{ dns_entry.get_split_value }} | +
+ {% blocktrans trimmed %} + If your {{ box_name }} runs on a cloud service infrastructure, you + should configure + Reverse DNS lookup. This isn't mandatory, however, it greatly improves + email deliverability. Reverse DNS isn't configured where your regular DNS + is. You should look for it in the settings of your VPS/ISP. Some providers + preconfigure the IP address part for you and you only have to set the + domain part. Only one of your domains can have Revese DNS lookup + configured unless you have multiple public IP addresses. + {% endblocktrans %} +
+ ++ {% blocktrans trimmed %} + An external service is used to lookup public IP address to show in the + following section. This can be configured in the privacy app. + {% endblocktrans %} +
+ +| {% trans "Host" %} | +{% trans "TTL" %} | +{% trans "Type" %} | +{% trans "Host/Target/Value" %} | +
|---|---|---|---|
| {{ dns_entry.domain|default_if_none:"" }} | +{{ dns_entry.ttl }} | +{{ dns_entry.type_ }} | +{{ dns_entry.get_split_value }} | +
{% blocktrans trimmed %} - The following DNS records must be added manually on your primary domain - for the mail server to work properly. + The following domains are configured. View details to see the list of DNS + entries to be made for the domain. {% endblocktrans %}
-| {% trans "Domain" %} | -{% trans "TTL" %} | -{% trans "Class" %} | -{% trans "Type" %} | -{% trans "Priority" %} | -{% trans "Weight" %} | -{% trans "Port" %} | -{% trans "Host/Target/Value" %} | -
|---|---|---|---|---|---|---|---|
| {{ dns_entry.domain|default_if_none:"" }} | -{{ dns_entry.ttl }} | -{{ dns_entry.class_ }} | -{{ dns_entry.type_ }} | -{{ dns_entry.priority }} | -{{ dns_entry.weight|default_if_none:"" }} | -{{ dns_entry.port|default_if_none:"" }} | -{{ dns_entry.get_split_value }} | -
- {% blocktrans trimmed %} - If your {{ box_name }} runs on a cloud service infrastructure, you - should configure - Reverse DNS lookup. This isn't mandatory, however, it greatly improves - email deliverability. Reverse DNS isn't configured where your regular DNS - is. You should look for it in the settings of your VPS. Some providers - preconfigure the IP address part for you and you only have to set the domain part. - {% endblocktrans %} -
- -| {% trans "Host" %} | -{% trans "TTL" %} | -{% trans "Type" %} | -{% trans "Host/Target/Value" %} | -
|---|---|---|---|
| {{ dns_entry.domain|default_if_none:"" }} | -{{ dns_entry.ttl }} | -{{ dns_entry.type_ }} | -{{ dns_entry.get_split_value }} | -