Skip to content

Add sieve mailfiltering #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Setup
cp mail-base/aliases.example mail-base/aliases
cp mail-base/domains.example mail-base/domains
cp mail-base/passwords.example mail-base/passwords
cp dovecot/default.sieve.example dovecot/default.sieve

2) Add all domains you want to receive mail for to the file `mail-base/domains`, like this:

Expand Down
6 changes: 6 additions & 0 deletions dovecot/90-sieve.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plugin {
sieve = ~/.dovecot.sieve
sieve_global_path = /var/lib/dovecot/sieve/default.sieve
sieve_dir = ~/sieve
sieve_global_dir = /var/lib/dovecot/sieve/
}
10 changes: 9 additions & 1 deletion dovecot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ RUN apt-get update \
postgrey \
# Install dovecot as IMAP server
dovecot-imapd \
# Install sieve for mail filtering
dovecot-sieve \
# Install sieve for mail filtering
dovecot-managesieved \
&& rm -rf /var/lib/apt/lists/*

# postfix configuration
Expand All @@ -18,6 +22,11 @@ ADD ./postfix.main.cf /etc/postfix/main.cf
ADD ./postfix.master.cf.append /etc/postfix/master-additional.cf
RUN cat /etc/postfix/master-additional.cf >> /etc/postfix/master.cf

# sieve configuration
ADD ./default.sieve /var/lib/dovecot/sieve/default.sieve
RUN sievec /var/lib/dovecot/sieve/default.sieve
ADD ./90-sieve.conf /etc/dovecot/conf.d/90-sieve.conf

# configure mail delivery to dovecot
#ADD ./aliases /etc/postfix/virtual
#ADD ./domains /etc/postfix/virtual-mailbox-domains
Expand Down Expand Up @@ -66,4 +75,3 @@ EXPOSE 587

# start necessary services for operation (dovecot -F starts dovecot in the foreground to prevent container exit)
ENTRYPOINT chown -R vmail:vmail /srv/vmail; service rsyslog start; service postgrey start; service postfix start; dovecot -F

12 changes: 12 additions & 0 deletions dovecot/default.sieve.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require ["vacation"];
if address :is ["From", "To"] "[email protected]" {
vacation
# Reply at most once a day to a same sender
:days 1
:subject "Out of Office"
# List of additional recipient addresses which are included in the auto replying.
# If a mail's recipient is not the envelope recipient and it's not on this list,
# no vacation reply is sent for it.
:addresses ["[email protected]"]
"Im out of office";
}
2 changes: 1 addition & 1 deletion dovecot/dovecot.lda
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
protocol lda {
hostname = mail.docker.container
postmaster_address = [email protected]
mail_plugin_dir = /usr/lib/dovecot/modules/lda
mail_plugins = $mail_plugins sieve
}