{% extends "dashboard/domain_detail/base.html" %} {% set domain_detail_page = "auto_create" %} {% block title %}{{ custom_domain.domain }} Auto Create Rules{% endblock %} {% block domain_detail_content %}

{{ custom_domain.domain }} auto create alias rules

Advanced Beta
{% if custom_domain.catch_all %}
Rules are ineffective when catch-all is enabled.
{% endif %}
For a greater control than a simple catch-all, you can define a set of rules to auto create aliases.
A rule is based on a regular expression (regex): if an alias fully matches the expression, it'll be automatically created.
Only the local part of the alias (i.e. @{{ custom_domain.domain }} is ignored) during the regex test.
When there are several rules, rules will be evaluated by their order.
{% if custom_domain.auto_create_rules | length > 0 %}
{% for auto_create_rule in custom_domain.auto_create_rules %}
Order: {{ auto_create_rule.order }}
New alias will belong to {% for mailbox in auto_create_rule.mailboxes %} {{ mailbox.email }} {% if not loop.last %},{% endif %} {% endfor %}
{% endfor %}
{% endif %}

New rule

{{ new_auto_create_rule_form.csrf_token }}
{{ new_auto_create_rule_form.regex(class="form-control", placeholder="prefix.*") }} {{ render_field_errors(new_auto_create_rule_form.regex) }}
For example, if you want aliases that starts with prefix to be automatically created, you can set the regex to prefix.*
If you want aliases that ends with suffix to be automatically created, you can use the regex .*suffix
To test out regex, we recommend using regex tester tool like https://regex101.com↗
{{ new_auto_create_rule_form.order(class="form-control", placeholder="10", min=1, value=1, type="number") }} {{ render_field_errors(new_auto_create_rule_form.order) }}

Debug Zone

You can test whether an alias will be automatically created given the rules above

No worries, no alias will be created during the test :)
{{ auto_create_test_form.csrf_token }}
{{ auto_create_test_form.local(class="form-control", type="text", placeholder="local", value=auto_create_test_local) }} {{ render_field_errors(auto_create_test_form.local) }} @{{ custom_domain.domain }}
{% if auto_create_test_result %}
{{ auto_create_test_result }}
{% endif %}
{% endblock %} {% block script %}{% endblock %}