-#opendkim-genkey -D /etc/dkimkeys -s "${selector}"
-opendkim-genkey -d "$(hostname -f)" -D /etc/dkimkeys -s "${selector}"
-
-# customize /etc/opendkim.conf
-echo '' >> /etc/opendkim.conf
-echo '# plomlompom customizations' >> /etc/opendkim.conf
-echo "Domain $(hostname -f)" >> /etc/opendkim.conf
-echo "KeyFile /etc/dkimkeys/${selector}.private" >> /etc/opendkim.conf
-echo "Selector ${selector}" >> /etc/opendkim.conf
-echo 'Socket inet:8892@localhost' >> /etc/opendkim.conf
-
-# customize /etc/postfix/main.cf
-echo '' >> /etc/postfix/main.cf
-echo '# opendkim milter' >> /etc/postfix/main.cf
-echo 'non_smtpd_milters = inet:localhost:8892' >> /etc/postfix/main.cf
-echo '' >> /etc/postfix/main.cf
-echo '# TLS certs'
-echo 'smtpd_tls_cert_file=/etc/letsencrypt/live/${myhostname}/fullchain.pem' >> /etc/postfix/main.cf
-echo 'smtpd_tls_key_file=/etc/letsencrypt/live/${myhostname}/privkey.pem' >> /etc/postfix/main.cf
-
-# TODO: consider <https://wiki.debian.org/opendkim#Postfix_integration>
-
-# Dovecot sieve filtering via LMTP
-echo '' >> /etc/postfix/main.cf
-echo '# transport mail to dovecot; not strictly needed, as even without this' >> /etc/postfix/main.cf
-echo '# postfix will throw mail to /var/mail/USER to be found by dovecot for' >> /etc/postfix/main.cf
-echo "# serving via IMAP etc.; but using dovecot's LMTP server for delivery" >> /etc/postfix/main.cf
-echo '# allows us to do stuff like dovecot-side sieve filtering.' >> /etc/postfix/main.cf
-echo 'mailbox_transport = lmtp:inet:127.0.0.1:2424' >> /etc/postfix/main.cf
+opendkim-genkey -d "${mail_domain}" -D /etc/dkimkeys -s "${selector}"
+sed -i "s/REPLACE_hostname_ECALPER/$(hostname -f)/g" /etc/opendkim.conf
+sed -i "s/REPLACE_selector_ECALPER/${selector}/g" /etc/opendkim.conf
+
+# Dovecot sieve filtering via LMTP. Without this, mail only gets
+# delivered to /var/mail/…, with it /var/mail/… remains the fallback
+# inbox, but all else is sieve-filtered to ~/mail/.