Dependency ordering
[hcoop/domtool2.git] / lib / alias.dtl
diff --git a/lib/alias.dtl b/lib/alias.dtl
new file mode 100644 (file)
index 0000000..0ced362
--- /dev/null
@@ -0,0 +1,47 @@
+{{E-mail aliases (AKA, redirects)}}
+
+extern type emailUser;
+{{A valid username to appear before the "@" in an e-mail address}}
+
+extern type email;
+{{A valid e-mail address.
+  It may also be a username only, in which case it is interpreted as a local
+  user's mailbox.}}
+
+extern type aliasSource;
+{{An e-mail recipient whose mail you want to redirect}}
+extern val userSource : emailUser -> aliasSource;
+{{The part appear before the "@" in your desired source address}}
+extern val defaultSource : aliasSource;
+{{Matches any mail to this domain that doesn't match any other rule, with the
+  exception of systemwide usernames like UNIX users.}}
+extern val catchAllSource : aliasSource;
+{{Matches any mail to this domain that doesn't match any other rule, even
+  for systemwide usernames.}}
+
+extern type aliasTarget;
+{{A place to redirect messages}}
+extern val addressTarget : email -> aliasTarget;
+{{Redirect to this e-mail address.}}
+extern val addressesTarget : [email] -> aliasTarget;
+{{Redirect to all of these addresses.}}
+extern val dropTarget : aliasTarget;
+{{Silently delete all mail to the associated source.}}
+
+extern val aliasPrim : aliasSource -> aliasTarget -> [Domain];
+{{Request redirection of all mail from the source to the target.}
+
+val alias = \user -> \email -> aliasPrim (userSource user) (addressTarget email);
+{{Redirect mail for the user at the current domain to the e-mail address.}}
+val aliasMulti = \user -> \emails -> aliasPrim (userSource user) (addressesTarget emails);
+{{Redirect mail for the user at the current domain to all of the e-mail
+  addresses listed.}}
+val aliasDrop = \user -> aliasPrim (userSource user) dropTarget;
+{{Silently delete mail to the user at the current domain.}}
+
+val defaultAlias = \email -> aliasPrim defaultSource (addressTarget email);
+{{When a message to the current domain doesn't match any other alias, and it
+  doesn't match any systemwide username, send it to this e-mail address
+val catchAllAlias = \email -> aliasPrim catchAllSource (addressTarget email);
+{{When a message to the current domain doesn't match any other alias, send it
+  to this e-mail address, even if it matches a systemwide username.}}