tbrehm
2007-06-02 277d5699af83ad8e155a613b2db86b0ab3b1ee2b
commit | author | age
9200ad 1 #
T 2 # Import variables
3 #
4
5 LOGNAME=tolower("$LOGNAME")
6 EXTENSION="$1"
7 RECIPIENT=tolower("$2")
8 USER="$3"
9 HOST="$4"
10 SENDER="$5"
11 DEFAULT="{dist_postfix_vmail_mailbox_base}/$HOST/$USER/."
12
13 if ( "$EXTENSION" ne "" )
14 {
15   DELIMITER="+"
16 }
17
18 if (!$SENDER)
19 {
20   SENDER = "<>"
21 }
22
23 #
24 # Autocreate maildir, if not existant
25 #
26
27 `test -e {dist_postfix_vmail_mailbox_base}/$HOST`
28 if ( $RETURNCODE != 0 )
29 {
30   `mkdir {dist_postfix_vmail_mailbox_base}/$HOST`
31 }
32
33 `test -e {dist_postfix_vmail_mailbox_base}/$HOST/$USER`
34 if ( $RETURNCODE != 0 )
35 {
36   `maildirmake {dist_postfix_vmail_mailbox_base}/$HOST/$USER`
37   `chmod -R 0700 {dist_postfix_vmail_mailbox_base}/$HOST`
38 }
39
40 #
41 # Check that user has his own maildrop include,
42 # if not available, check if $DEFAULT is set
43 # (newer maildrop get's that from the DB and updates
44 # it) and deliver or fail temporarily if not available
45 #
46
47 `test -f {dist_postfix_vmail_mailbox_base}/mailfilters/$LOGNAME`
48 if ( $RETURNCODE == 0 )
49 {
50   include "{dist_postfix_vmail_mailbox_base}/mailfilters/$LOGNAME"
51 }
52 else
53 {
54   if ( "$DEFAULT" ne "" )
55   {
56     to "$DEFAULT"
57   }
58   else
59   {
60     EXITCODE=75
61     exit
62   }
63 }