aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mail/templates/postfix/virtual-aliases.j2
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-03-06 22:44:24 +0800
committerAaron LI <aly@aaronly.me>2018-03-14 11:35:08 +0800
commitc3cf54288387b9b6cd7165f974f36bea7c396841 (patch)
tree494b469f5cbb3c42ee992811e531e4f31bdfdc86 /roles/mail/templates/postfix/virtual-aliases.j2
parent89e40ceb20251c9a51de4fc4b334c144d4b2310d (diff)
downloadansible-dfly-vps-c3cf54288387b9b6cd7165f974f36bea7c396841.tar.bz2
mail/postfix: rename "virtual" to "virtual-aliases"
Diffstat (limited to 'roles/mail/templates/postfix/virtual-aliases.j2')
-rw-r--r--roles/mail/templates/postfix/virtual-aliases.j235
1 files changed, 35 insertions, 0 deletions
diff --git a/roles/mail/templates/postfix/virtual-aliases.j2 b/roles/mail/templates/postfix/virtual-aliases.j2
new file mode 100644
index 0000000..5c60ff2
--- /dev/null
+++ b/roles/mail/templates/postfix/virtual-aliases.j2
@@ -0,0 +1,35 @@
+#
+# /usr/local/etc/postfix/virtual-aliases
+# Postfix: $virtual_alias_maps
+#
+# Lookup table that alias specific mail addresses or domains to other
+# local or remote address. Therefore, mails for the left-hand side
+# addresses (i.e., aliases) will be *forwarded* to the right-hand side
+# addresses.
+#
+# Here, we alias all valid (receiving) mail addresses to the virtual(8)
+# destinations, as listed in $virtual_mailbox_maps .
+#
+# Aaron LI
+#
+
+#======#
+# NOTE # Once modified this file, run "postmap" on it!
+#======#
+
+# Alias address | Recipient for virtual(8)
+# ---------------------------------------------------------------------
+{% set mydomain = mail.domains[0] %}
+{% for domain in mail.domains %}
+# [domain: {{ domain }}]
+{% for user in mail.userdb %}
+# (user: {{ user.name }})
+{{ user.name }}@{{ domain }} {{ user.name }}@{{ mydomain }}
+{% if user.aliases is defined %}
+# aliases
+{% for alias in user.aliases|default([]) %}
+{{ alias }}@{{ domain }} {{ user.name }}@{{ mydomain }}
+{% endfor %}{# alias #}
+{% endif %}{# aliases #}
+{% endfor %}{# user #}
+{% endfor %}{# domain #}