mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-03 17:44:49 +02:00
Implement basic sieve support using Dovecot.
The dovecot-sieve plugin is installed and configured to apply sieve as soon as a .dovecot.sieve file is encountered in the virtual user's home directory (that is /var/mail/${domain}/${username}/.dovecot.sieve). Transport has been changed in the postfix configuration to use Dovecot LDA (see http://wiki.dovecot.org/LDA/Postfix) to actually enable sieve filtering. Tests have been added.
This commit is contained in:
parent
1a77cb77cc
commit
2f9f6b1002
8 changed files with 49 additions and 4 deletions
8
test/config/sieve/dovecot.sieve
Normal file
8
test/config/sieve/dovecot.sieve
Normal file
|
@ -0,0 +1,8 @@
|
|||
require ["fileinto", "reject"];
|
||||
|
||||
if address :contains ["From"] "spam@spam.com" {
|
||||
fileinto "INBOX.spam";
|
||||
} else {
|
||||
keep;
|
||||
}
|
||||
|
12
test/email-templates/sieve-spam-folder.txt
Normal file
12
test/email-templates/sieve-spam-folder.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
HELO mail.external.tld
|
||||
MAIL FROM: user@external.tld
|
||||
RCPT TO: user1@localhost.localdomain
|
||||
DATA
|
||||
From: Spambot <spam@spam.com>
|
||||
To: Existing Local User <alias2@localhost.localdomain>
|
||||
Date: Sat, 22 May 2010 07:43:25 -0400
|
||||
Subject: Test Message
|
||||
This is a test mail.
|
||||
|
||||
.
|
||||
QUIT
|
|
@ -129,9 +129,9 @@
|
|||
}
|
||||
|
||||
@test "checking smtp: delivers mail to existing account" {
|
||||
run docker exec mail /bin/sh -c "grep 'status=sent (delivered to maildir)' /var/log/mail/mail.log | wc -l"
|
||||
run docker exec mail /bin/sh -c "grep 'status=sent (delivered via dovecot service)' /var/log/mail/mail.log | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" -eq 2 ]
|
||||
[ "$output" -eq 3 ]
|
||||
}
|
||||
|
||||
@test "checking smtp: delivers mail to existing alias" {
|
||||
|
@ -409,3 +409,13 @@
|
|||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "my-domain.com" ]
|
||||
}
|
||||
|
||||
#
|
||||
# sieve
|
||||
#
|
||||
|
||||
@test "checking sieve: user1 should have received 1 in folder INBOX.spam" {
|
||||
run docker exec mail /bin/sh -c "ls -A /var/mail/localhost.localdomain/user1/.INBOX.spam/new | wc -l"
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = 1 ]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue