1 (edited by noob 2016-06-27 14:41:50)

Topic: Block emails marked as spam

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: Ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
====

I tried to block spam by adding to /etc/postfix/header_checks:


/X-SPAM-FLAG:.YES/ DISCARD   spam message

or


/X-SPAM-FLAG: YES/ REJECT   spam message

And still... marked email are not rejected.

p.s. in /etc/postfix/header_checks i have a lot of rejected emails from many domains and  this works

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Block emails marked as spam

In iRedMail, as in most mail servers, Spamassassin is set up as an "after-queue" filter.  That means your server first accepts the mail from the sending server, puts it in the local mail queue, and then your Postfix runs the message through Amavis/Spamassassin.  Even if Spamassassin decides the message is spam, it's too late to reject the message because your server already accepted it.

On the other hand, Postfix header checks (and postscreen checks, etc) are done "before-queue", meaning they happen before your Postfix accepts and queues the message.  Therefore, they are able to make Postfix reject a message.

If you don't want tagged spam showing up in your Junk folder, you could have iRedMail quarantine it.

3

Re: Block emails marked as spam

So... that X-SPAM-FLAG is added "after-queue" ?

4

Re: Block emails marked as spam

noob wrote:

So... that X-SPAM-FLAG is added "after-queue" ?

YES.

5

Re: Block emails marked as spam

deltatango wrote:

If you don't want tagged spam showing up in your Junk folder, you could have iRedMail quarantine it.

Well, and who will process the quarantined mails? Could the solution be that I change the before-queue/after-queue settings and the quarantined mails will be processed at late night?

6

Re: Block emails marked as spam

Amavisd will quarantined detected spam/virus on file system by default.

You can also quarantine them to SQL db by following this tutorial, and manage them with iRedAdmin-Pro:
http://www.iredmail.org/docs/quarantining.html

7

Re: Block emails marked as spam

ZhangHuangbin wrote:

Amavisd will quarantined detected spam/virus on file system by default.

Zhang,
where can I find these quarantined spam messages? And if, is there an easy way to "restore" them to the user's mailbox?

many thanks in advance
Andy

8

Re: Block emails marked as spam

Hi @ablaha,

Please check our tutorial below:
http://www.iredmail.org/docs/quarantining.html

*) With "$final_spam_destiny = D_DISCARD;" in Amavisd, spam won't be delivered to user's mailbox.
*) With "$spam_quarantine_to = 'spam-quarantine';", Amavisd will quarantine spam.
*) With "$spam_quarantine_method = 'sql:';" Amavisd will quarantine spam to SQL database. Without this setting, Amavisd will use its default setting and quarantine spam to file system -- the directory is defined in parameter "$QUARANTINEDIR", it's a sub-directory of $MYHOME.

9

Re: Block emails marked as spam

ZhangHuangbin wrote:

Hi @ablaha,

Please check our tutorial below:
http://www.iredmail.org/docs/quarantining.html

*) With "$final_spam_destiny = D_DISCARD;" in Amavisd, spam won't be delivered to user's mailbox.
*) With "$spam_quarantine_to = 'spam-quarantine';", Amavisd will quarantine spam.
*) With "$spam_quarantine_method = 'sql:';" Amavisd will quarantine spam to SQL database. Without this setting, Amavisd will use its default setting and quarantine spam to file system -- the directory is defined in parameter "$QUARANTINEDIR", it's a sub-directory of $MYHOME.

Many thanks,
I am a few steps further now. All was set to undef by default, I now get spam (and other unwanted stuff) quarantined, but notifications do not work although configured in amavisd.conf, also can't get amavisd-release to work, somehow the id does not correlate with the one of the quarantined mail?

10

Re: Block emails marked as spam

It's hard to help without knowing your current Amavisd config. You'd better turn on debug mode in Amavisd and check the log. FYI: http://www.iredmail.org/docs/debug.amavisd.html