getmail: rewrite „Return-Path“ to „Sender Email“ with ISPConfig
Rspamd is reading the header „Return-Path“ but this is normally already occupied by getmail and therefore interferes with the spamfilter white/blacklists of ISPConfig. To avoid this, you have to pass sendmail (actually the „Postfix to Sendmail compatibility interface“) the following additional parameter
arguments = "-f", "%(sender)"
Create master config file
This is necessary so that the file is not overwritten again during the next ISPConfig update.
cp /usr/local/ispconfig/server/conf/getmail.conf.master /usr/local/ispconfig/server/conf-custom/
Add parameters
vi /usr/local/ispconfig/server/conf-custom/getmail.conf.master
# vi /usr/local/ispconfig/server/conf-custom/getmail.conf.master
# ISPConfig: Tools > Resync > Fetchmail
[options]
# message_log = /var/log/getmail.log
message_log_syslog = true
delete = {DELETE}
read_all = {READ_ALL}
[retriever]
type = {TYPE}
server = {SERVER}
username = {USERNAME}
password = {PASSWORD}
[destination]
type = MDA_external
path = /usr/sbin/sendmail
arguments = ("-f", "%(sender)", "-i", "-bm", "{DESTINATION}")
unixfrom = true
Force Update
to apply the configuration
ispconfig_update.sh --force
Update configuration files of getmail jobs
ISPConfig GUI: Tools → Resync → Fetchmail
Test
grep sender /etc/getmail/*
/etc/getmail/export_imap_mail_yahoo_com_user_ymail_com.conf:arguments = ("-f", "%(sender)", "-i", "-bm", "[email protected]")
Finished!
As of the next cronjob, the „return path“ in the mail header is set to the sender address.
Fetch mails
sudo -u getmail /usr/local/bin/run-getmail.sh