Install
sudo apt -y install dovecot-core dovecot-imapd dovecot-lmtpd dovecot-sieve dovecot-managesieved sudo apt -y install postfix
Settings
Dovecot Docs
https://doc.dovecot.org/configuration_manual/howto/postfix_dovecot_lmtp/
[postfix/main.cf]
home_mailbox = Maildir/ mailbox_transport = lmtp:inet:127.0.0.1:24 # or > mailbox_transport = lmtp:inet:localhost #mailbox_transport = lmtp:unix:/var/spool/postfix/private/dovecot-lmtp
focal does not include /var/spool/postfix/private/dovecot-lmtp
in apt package.
use inet.
- compare package
focal (20.04LTS) https://packages.ubuntu.com/focal/amd64/dovecot-lmtpd/filelist
hirsute (21.04) https://packages.ubuntu.com/hirsute/amd64/dovecot-lmtpd/filelist
[dovecot/10-mail.conf]
mail_location = maildir:~/Maildir
[dovecot/10-master.conf] port=24
lmtp is for postfix local delivery.
service lmtp { unix_listener lmtp { #mode = 0666 } inet_listener lmtp { address = 127.0.0.1 port = 24 } }
[dovecot/20-managesieve.conf] port=4190
managesieve edit user filtering files.
protocols = $protocols sieve
[dovecot/90-sieve.conf]
plugin { sieve = file:~/sieve;active=~/.dovecot.sieve }
enable RainLoop sieve
Create symbolic link .dovecot.sieve -> sieve/rainloop.user.sieve
cd /home/user_name/ ln -s .dovecot.sieve ./sieve/rainloop.user.sieve
Spam Filtering for RainLoop
[dovecot/90-sieve.conf]
plugin { sieve = file:~/sieve;active=~/.dovecot.sieve # comment out, or add this. sieve_before = /var/lib/dovecot/sieve.d/ }
Create directory.
cd /var/lib/dovecot/ mkdir sieve.d
Check spam directory. (example)
ls -al /home/user_name/Maildir/ .Junk E-mail
Create .sieve
file.
[/var/lib/dovecot/sieve.d/X-Spam-Flag.sieve]
require "fileinto"; if header :contains ["X-Spam-Flag"] "Yes" { fileinto "Junk E-mail"; stop; }
No period is required.
RainLoop installation
https://good-arrow.hatenablog.com/entry/2022/04/12/170038IntegratedSpamdInPostfix
https://cwiki.apache.org/confluence/display/SPAMASSASSIN/IntegratedSpamdInPostfixspamcop.net
https://www.spamcop.net/fom-serve/cache/349.htmlspamhaus
https://www.spamhaus.org/BarracudaCentral
https://www.barracudacentral.org/rbl