113654b6a82c7a7733d2b035d399f1e5a422e1e0
[hcoop/domtool2.git] / lib / alias.dtl
1 {{E-mail aliases (AKA, redirects)}}
2
3 extern type emailUser;
4 {{A valid username to appear before the "@" in an e-mail address}}
5
6 extern type email;
7 {{A valid e-mail address.
8 It may also be a username only, in which case it is interpreted as a local
9 user's mailbox.}}
10
11 extern type aliasSource;
12 {{An e-mail recipient whose mail you want to redirect}}
13 extern val userSource : emailUser -> aliasSource;
14 {{The part appear before the "@" in your desired source address}}
15 extern val defaultSource : aliasSource;
16 {{Matches any mail to this domain that doesn't match any other rule, with the
17 exception of systemwide usernames like UNIX users.}}
18 extern val catchAllSource : aliasSource;
19 {{Matches any mail to this domain that doesn't match any other rule, even
20 for systemwide usernames.}}
21
22 extern type aliasTarget;
23 {{A place to redirect messages}}
24 extern val addressTarget : email -> aliasTarget;
25 {{Redirect to this e-mail address.}}
26 extern val addressesTarget : [email] -> aliasTarget;
27 {{Redirect to all of these addresses.}}
28 extern val dropTarget : aliasTarget;
29 {{Silently delete all mail to the associated source.}}
30
31 extern val aliasPrim : aliasSource -> aliasTarget -> [Domain] {MailNodes: [mail_node]};
32 {{Request redirection of all mail from the source to the target, specifying on
33 which nodes this redirection should be applied.}}
34
35 val emailAlias = \user -> \email -> aliasPrim (userSource user) (addressTarget email);
36 {{Redirect mail for the user at the current domain to the e-mail address.}}
37 val aliasMulti = \user -> \emails -> aliasPrim (userSource user) (addressesTarget emails);
38 {{Redirect mail for the user at the current domain to all of the e-mail
39 addresses listed.}}
40 val aliasDrop = \user -> aliasPrim (userSource user) dropTarget;
41 {{Silently delete mail to the user at the current domain.}}
42
43 val defaultAlias = \email -> aliasPrim defaultSource (addressTarget email);
44 {{When a message to the current domain doesn't match any other alias, send it to
45 this e-mail address.}}