summaryrefslogtreecommitdiff
path: root/test/tests/queue/rewrite
blob: 780aa3b0cfc181bbe41d00d3ae4e6fe308528cb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
. functions

que() {
	set -e
	../src/nullmailer-queue && \
	cat $QUEUEDIR/queue/* && \
	rm -f $QUEUEDIR/queue/*
}
que-recip() {
	set -e
	que | sed -e '2,/^$/!d' | grep -q "$@"
}
que-sender() {
	set -e
	que | head -n 1 | grep -q "$@"
}

echo admin@remote >$SYSCONFDIR/adminaddr

echo "Checking that queue rewrites user@localhost to adminaddr."
que-recip '^admin@remote$' <<EOF
bruceg@qcc.sk.ca
user@localhost

header

data
EOF

echo "Checking that queue rewrites user@hostname to adminaddr."
que-recip '^admin@remote$' <<EOF
bruceg@qcc.sk.ca
user@f.q.d.n

header

data
EOF

echo "Checking that queue does not rewrite non-local users."
que-recip '^user@nowhere.org$' <<EOF
bruceg@qcc.sk.ca
user@nowhere.org

header

data
EOF

echo admin1@remote1,admin2@remote2 >$SYSCONFDIR/adminaddr

echo "Checking that queue rewrites to multiple adminaddr."
que-recip '^admin2@remote2$' <<EOF
bruceg@qcc.sk.ca
user@localhost

header

data
EOF

echo "Checking that queue transmits the envelope sender normally."
que-sender '^bruceg@qcc.sk.ca$' <<EOF
bruceg@qcc.sk.ca
user@localhost

header

data
EOF

echo "Checking that queue rewrites sender with allmailfrom."
echo sender@remote3 >$SYSCONFDIR/allmailfrom
que-sender '^sender@remote3$' <<EOF
bruceg@qcc.sk.ca
user@localhost

header

data
EOF
rm -f $SYSCONFDIR/allmailfrom