All my mails are received by my own mail server and are then forwarded to my Google account (as I am using Google Mail as my mail client). Unfortunately if you just forward mails with POSTFIX you might also forward incoming spam mails which Google does not like. It can be that Google thinks you are a spam sender and blacklist your server.

I have found this blog entry which describes a way to correctly set the envelope address of forwarded mails:

So in summary this is what I did:

# download and compile the software
cd ~
unzip master
cd postsrsd-master/
sudo make install

Then added the following lines to /etc/postfix/

sender_canonical_maps = tcp:
sender_canonical_classes = envelope_sender
recipient_canonical_maps = tcp:
recipient_canonical_classes= envelope_recipient,header_recipient

Then I started the SRS daemon and reloaded the POSTFIX configuration:

# Start SRS daemon
sudo service postsrsd restart
#Reload postfix
sudo service postfix reload

I did not need to add the SRS daemon to startup as it seems to be automatically started already.

As I forward all mail from my server to Expurgate/Spamfence for spam checking I also neeeded to add the Expurgate servers to my SPF domain record so that Google accepts mails sent by my mail server via Expurgate to Google. This is the PSF record I am using for my domain "":

v=spf1 a mx ip4: ip6:2a01:488:66:1000:57e6:5590:0:1 ~all

Currently it seems to look fine as Google verifies the SPF record although the mails are forwarded twice:

Return-Path: <>
Received: from ( [])
by with ESMTPS id ft4si45524597pdb.17.2014.
for <>
(version=TLSv1.2 cipher=RC4-SHA bits=128/128);
Sat, 27 Dec 2014 06:00:53 -0800 (PST)
Received-SPF: pass ( domain of designates as permitted sender) client-ip=;
spf=pass ( domain of designates as permitted sender);


If you cannot start the service in Debain 8 and higher () you need to enable the service first with

systemctl enable postsrsd

Forwarding mails to Google Account
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *