Tran Nghi's Site  - Make notes and share experience

Mail filtering and improving the score of sending email

Resources:

1) https://help.ubuntu.com/lts/serverguide/mail-filtering.html
2) https://help.ubuntu.com/community/PostfixAmavisNew

The recommended and easiest way to install Pyzor is with pip:

[email protected]:~# pip install pyzor

In order to upgrade your Pyzor version run:

[email protected]:~# pip install –upgrade pyzor

For me, the latest pyzor-1.0.0 seemed to not working on my environment.

Ubuntu 16.04.3
Postfix 3.1.0
Dovecot 0.4.13
SpamAssassin version 3.4.1 running on Perl version 5.22.1
Amavisd-new-2.10.1 (20141025)
Python 2.7.12

Pyzor-1.0.0 was come up with some error, like this:

Traceback (most recent call last):
File “/usr/local/bin/pyzor”, line 4, in <module>
__import__(‘pkg_resources’).run_script(‘pyzor==1.0.0’, ‘pyzor’)
File “/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py”, line 739, in run_script
self.require(requires)[0].run_script(script_name, ns)
File “/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py”, line 1486, in run_script
raise ResolutionError(“No script named %r” % script_name)
pkg_resources.ResolutionError: No script named ‘pyzor’

So, I decided to use Pyzor-0.9.0, hopefully it’s working well.
Hereby is how I start pyzor:

[email protected]:~# wget https://<find the source link from internet, please>/pyzor-0.9.0.tar.gz
[email protected]:~# tar xvf pyzor-0.9.0.tar.gz
[email protected]:~# cd pyzor-0.9.0
[email protected]:~# python setup.py build
[email protected]:~# python setup.py install

Make sure that you enable spamassassin, and check out Amavis’s configuration

[email protected]:~# vi /etc/default/spamassassin

[email protected]:~# vi /etc/amavis/conf.d/15-content_filter_mode

 

For Postfix integration, enter the following from a terminal prompt:

[email protected]:~# postconf -e ‘content_filter = smtp-amavis:[127.0.0.1]:10024’

Next edit /etc/postfix/master.cf and add the following to the end of the file:

[email protected]:~# vi /etc/postfix/master.cf

[email protected]:~# vi /etc/spamassassin/local.cf

Restart all the services:
[email protected]:~# systemctl start spamassassin.service
[email protected]:~# systemctl restart amavis.service
[email protected]:~# systemctl restart postfix.service
[email protected]:~# systemctl restart dovecot.service

Make a test:
[email protected]:~# echo “test” | spamassassin -D pyzor 2>&1 | less

Check by from websites:
https://www.mail-tester.com/
or
https://www.unlocktheinbox.com/mail-tester/

Message