1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00

Support domain literals for receiving emails

This commit is contained in:
hoellen 2019-08-14 01:21:25 +02:00
parent bed2c6ea09
commit b720bedf72
2 changed files with 5 additions and 1 deletions

View File

@ -2,10 +2,13 @@ from mailu import models
from mailu.internal import internal from mailu.internal import internal
import flask import flask
import re
@internal.route("/postfix/domain/<domain_name>") @internal.route("/postfix/domain/<domain_name>")
def postfix_mailbox_domain(domain_name): def postfix_mailbox_domain(domain_name):
if re.match("^\[.*\]$", domain_name):
return flask.abort(404)
domain = models.Domain.query.get(domain_name) or \ domain = models.Domain.query.get(domain_name) or \
models.Alternative.query.get(domain_name) or \ models.Alternative.query.get(domain_name) or \
flask.abort(404) flask.abort(404)
@ -29,7 +32,7 @@ def postfix_alias_map(alias):
@internal.route("/postfix/transport/<path:email>") @internal.route("/postfix/transport/<path:email>")
def postfix_transport(email): def postfix_transport(email):
if email == '*': if email == '*' or re.match("(^|.*@)\[.*\]$", email):
return flask.abort(404) return flask.abort(404)
localpart, domain_name = models.Email.resolve_domain(email) localpart, domain_name = models.Email.resolve_domain(email)
relay = models.Relay.query.get(domain_name) or flask.abort(404) relay = models.Relay.query.get(domain_name) or flask.abort(404)

View File

@ -0,0 +1 @@
Support domain literals