MimeDefang is a program that add extra X-anti-abuse headers to your email
it also cause your emails to be scanned with spamassasin and a few more tricks that it apply
To start just follow the following steps
yum install mimedefang
in /etc/sysconfig/mimedefang
uncomment and edit the SOCKET
line to:
SOCKET=inet:10997
Make the port whatever you want, 10997 is my random choice.
Now:
service mimedefang start
chkconfig mimedefang on
And now you can simply add the milter config to /etc/postfix/main.cf
smtpd_milters = inet:10997
so now your config looks like this
smtpd_milters = inet:10997 inet:127.0.0.1:8891
non_smtpd_milters = inet:127.0.0.1:8891
milter_default_action = accept
compatibility_level = 2
and in /etc/mail/mimedefang-filter.cf
you can edit and apply following settings
at the filter-begin
search for
if ($action eq "tempfail") {
action_tempfail("Problem running virus-scanner");
md_syslog('warning', "Problem running virus scanner: code=$code, category=$category, action=$action");
}
then under it apply the following
#custom filter
action_add_header("X-AntiAbuse-virusscanner", "$category");
action_add_header("X-AntiAbuse-Helo", "$Helo");
action_add_header("X-AntiAbuse-Relayhostname", "$RelayHostname");
action_add_header("X-AntiAbuse-Relayaddr", "$RelayAddr");
action_add_header("X-AntiAbuse-Sender", "$Sender ");
if those are done then you can execute the following commands to restart the services and time to do a test email
service mimedefang restart
service postfix restart
after restart you can test out to see if the email works
send a email to a forwarded adress that forwards to gmail and you can see if your headers get a pass or fail
if done correctly then it should pass Dkim/Dmarc and SPF records and you should see the following into your email
dkim=pass header.i=@protonmail.com header.s=protonmail3 header.b=TxDa06R7;
dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.com
X-AntiAbuse-virusscanner: ok
X-AntiAbuse-Helo: mail-41104.protonmail.ch
X-AntiAbuse-Relayhostname: mail-41104.protonmail.ch
X-AntiAbuse-Relayaddr: 185.70.41.104
X-AntiAbuse-Sender: <vpsdata@protonmail.com>
X-AntiAbuse-Score: -0.007 () FREEMAIL_FROM,HTML_MESSAGE,SPOOFED_FREEMAIL,T_SCC_BODY_TEXT_LINE
Be sure to also check out our SRS guide to pass SPF records with forwarders