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

# message_log = /var/log/getmail.log
message_log_syslog = true
delete = {DELETE}
read_all = {READ_ALL}

type = {TYPE}
server = {SERVER}
username = {USERNAME}
password = {PASSWORD}

type = MDA_external
path = /usr/sbin/sendmail
arguments = ("-f", "%(sender)", "-i", "-bm", "{DESTINATION}")
unixfrom = true

Force Update

to apply the configuration --force

Update configuration files of getmail jobs

ISPConfig GUI: Tools → Resync → Fetchmail


grep sender /etc/getmail/*
/etc/getmail/export_imap_mail_yahoo_com_user_ymail_com.conf:arguments = ("-f", "%(sender)", "-i", "-bm", "[email protected]")


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/