1
require "vnd.dovecot.testsuite";
5
require "comparator-i;ascii-numeric";
11
test_set "message" text:
12
From: stephan@rename-it.nl
13
To: nico@vestingbar.nl
21
notify "mailto:stephan@rename-it.nl";
23
if not test_result_execute {
24
test_fail "failed to execute notify";
29
if not header :matches "Auto-Submitted" "auto-notified*" {
30
test_fail "auto-submitted header set inappropriately";
33
if not exists "X-Sieve" {
34
test_fail "x-sieve header missing from outgoing message";
44
test_set "message" text:
45
From: stephan@rename-it.nl
46
To: nico@vestingbar.nl
53
test "Multiple recipients" {
54
notify "mailto:timo@example.com%2cstephan@dovecot.org?cc=postmaster@vestingbar.nl&subject=Frop%20received";
56
if not test_result_execute {
57
test_fail "failed to execute notify";
62
if not address :is "to" "timo@example.com" {
63
test_fail "first To address missing";
66
if not address :is "to" "stephan@dovecot.org" {
67
test_fail "second To address missing";
70
if not address :is "cc" "postmaster@vestingbar.nl" {
71
test_fail "first Cc address missing";
74
if not address :count "eq" :comparator "i;ascii-numeric" "to" "2" {
75
test_fail "too many recipients in To header";
78
if not address :count "eq" :comparator "i;ascii-numeric" "cc" "1" {
79
test_fail "too many recipients in Cc header";
82
if not header "subject" "Frop received" {
83
test_fail "subject header set incorrectly";
88
if not header :matches "Auto-Submitted" "auto-notified*" {
89
test_fail "auto-submitted header not found for second message";
94
if not header :matches "Auto-Submitted" "auto-notified*" {
95
test_fail "auto-submitted header not found for third message";
100
* Duplicate recipients
105
test_set "message" text:
106
From: stephan@rename-it.nl
107
To: nico@vestingbar.nl
114
test "Duplicate recipients" {
115
notify "mailto:timo@example.com%2cstephan@dovecot.org?cc=stephan@dovecot.org";
116
notify "mailto:stephan@rename-it.nl?cc=timo@example.com";
118
if not test_result_execute {
119
test_fail "failed to execute notify";
122
test_message :smtp 0;
124
if address "Cc" "stephan@dovecot.org" {
125
test_fail "duplicate recipient not removed from first message";
128
test_message :smtp 1;
130
if address "Cc" "timo@example.com" {
131
test_fail "duplicate recipient not removed from second message";
137
* Notifying on automated messages
142
test_set "message" text:
143
From: stephan@rename-it.nl
144
To: nico@vestingbar.nl
145
Auto-submitted: auto-notify
152
test "Notifying on automated messages" {
153
notify "mailto:stephan@rename-it.nl?cc=timo@example.com";
155
if not test_result_execute {
156
test_fail "failed to execute notify";
159
if test_message :smtp 0 {
160
test_fail "notified of auto-submitted message";
168
test_set "message" text:
169
From: stephan@rename-it.nl
170
To: nico@vestingbar.nl
179
test_set "envelope.from" "sirius@rename-it.nl";
180
test_set "envelope.to" "bertus@vestingbar.nl";
183
notify "mailto:stephan@rename-it.nl?cc=timo@example.com";
185
if not test_result_execute {
186
test_fail "failed to execute notify";
189
test_message :smtp 0;
191
if not envelope :localpart :is "from" "postmaster" {
192
test_fail "envelope sender set incorrectly";
195
if not envelope :is "to" "stephan@rename-it.nl" {
196
test_fail "envelope sender set incorrectly";
199
test_message :smtp 1;
201
if not envelope :localpart :is "from" "postmaster" {
202
test_fail "envelope sender set incorrectly";
205
if not envelope :is "to" "timo@example.com" {
206
test_fail "envelope sender set incorrectly";
214
test_set "message" text:
215
From: stephan@rename-it.nl
216
To: nico@vestingbar.nl
223
test_set "envelope.from" "sirius@rename-it.nl";
224
test_set "envelope.to" "bertus@vestingbar.nl";
228
test "Envelope :from" {
229
notify :from "nico@vestingbar.nl"
230
"mailto:stephan@rename-it.nl?cc=timo@example.com";
232
if not test_result_execute {
233
test_fail "failed to execute notify";
236
test_message :smtp 0;
238
if not envelope :is "from" "nico@vestingbar.nl" {
239
test_fail "envelope sender set incorrectly";
242
if not envelope :is "to" "stephan@rename-it.nl" {
243
test_fail "envelope sender set incorrectly";
246
test_message :smtp 1;
248
if not envelope :is "from" "nico@vestingbar.nl" {
249
test_fail "envelope sender set incorrectly";
252
if not envelope :is "to" "timo@example.com" {
253
test_fail "envelope sender set incorrectly";
261
test_set "message" text:
262
From: stephan@rename-it.nl
263
To: nico@vestingbar.nl
270
test_set "envelope.from" "<>";
271
test_set "envelope.to" "bertus@vestingbar.nl";
276
notify :from "nico@vestingbar.nl"
277
"mailto:stephan@rename-it.nl?cc=timo@example.com";
279
if not test_result_execute {
280
test_fail "failed to execute notify";
283
test_message :smtp 0;
285
if not envelope :is "from" "" {
286
test_fail "envelope sender set incorrectly";
289
if not envelope :is "to" "stephan@rename-it.nl" {
290
test_fail "envelope sender set incorrectly";
293
test_message :smtp 1;
295
if not envelope :is "from" "" {
296
test_fail "envelope sender set incorrectly";
299
if not envelope :is "to" "timo@example.com" {
300
test_fail "envelope sender set incorrectly";