Koozali.org: home of the SME Server

procmail forwards all email to the junk folder

Offline oegeeks

  • *
  • 18
  • +0/-0
procmail forwards all email to the junk folder
« on: August 23, 2017, 04:08:07 PM »
SMESERVER 9.2
I use get mail to fetch emails.
getmail uses either procmail or maildrop.
Still the same behavior.

following .procmailrc file:

#              !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------

# ---- Defaults ------------------
SHELL=/bin/bash
DEFAULT=$HOME/Maildir/
FORMAIL=/usr/bin/formail
MAILDIR=$HOME/Maildir/
PMDIR=$HOME
SENDMAIL=/usr/sbin/sendmail



# ----  some logging------------------
VERBOSE=no
LOGFILE=$HOME/procmail.log


# ----  delete duplicates -------
:0 Wh: msgid.lock
| $FORMAIL -D 8192 msgid.cache


# ---start of Global rules---------

:0
* ^Subject.*[SPAM]
$MAILDIR/.junkmail/



# ----  to the inbox------------------
:0 w
| /usr/libexec/dovecot/deliver

# ----  end of rules ------------------

.procmailrc (END)

Systemwide Spam forwarding is disabled for testing purposes.
What could cause this behavior? Only locally delivered mail from getmail gets in the inbox. But than the filtering does not work.




Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: procmail forwards all email to the junk folder
« Reply #1 on: August 23, 2017, 08:43:42 PM »
getmail is not part of sme base.

unless you use sieve you should have :


Code: [Select]
# ----  to the inbox------------------
:0
$DEFAULT

you issue is then not with procmail but sieve doing more filtering with /usr/libexec/dovecot/deliver
you might have installed https://wiki.contribs.org/Dovecot-extras

Offline oegeeks

  • *
  • 18
  • +0/-0
Re: procmail forwards all email to the junk folder
« Reply #2 on: August 24, 2017, 09:29:00 AM »

you issue is then not with procmail but sieve doing more filtering with /usr/libexec/dovecot/deliver
you might have installed https://wiki.contribs.org/Dovecot-extras

Hi Jean-Philippe,
thanks for your hint. I debugged the problem with dovecot-extra disabled and with procmail and mail drop.

It seems that the filter rule does not work as expected. Now i added the following rule and it works for mail drop:
if (( /^Subject.*[SPAM]/) && (/^X-Spam-Flag: YES.*/ ))

I did not test for procmail any more. But if all mails, even those without [SPAM] get into the junkmail folder, the rule does not work as expected. I edited the rule in the WebGui with the mail sort contrib.

Is this a bug or is this expected behavior?
Best regards
Andreas

Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: procmail forwards all email to the junk folder
« Reply #3 on: August 27, 2017, 10:01:02 PM »
as I said, your issue was not related to procmail, but for chaining dovecot extra and sieve behind witout a proper configuration of sieve.

your issue was resolved by disabling dovecot-extra / sieve, not by switching from procmail to maildrop.

Just switching from procmail to maildrop would have only ended up with the same result as sieve would have still not been set up correctly.

Offline oegeeks

  • *
  • 18
  • +0/-0
Re: procmail forwards all email to the junk folder
« Reply #4 on: August 28, 2017, 08:40:54 AM »
your issue was resolved by disabling dovecot-extra / sieve, not by switching from procmail to maildrop.
Hi Jean-Philippe,
unfortunately you are not correct. Just disabling dovecot-extra / sieve did not help. I had to rewrite the spam-rule.

I testet procmail and mail drop without dovecot-extra. To no avail. Because the test configuration was on mail drop i did not test procmail with the new spam rule any more.

When i added  & (/^X-Spam-Flag: YES.*/ ) to the spam rule it worked for me.

Best regards
Andreas


Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: procmail forwards all email to the junk folder
« Reply #5 on: August 28, 2017, 09:25:32 PM »
Oh indeed, your issue is linked to your faulty rule.

you do not have to write any procmail or maildrop rule, there is already one implemented in .qmail files.

Code: [Select]
| condredirect jppialasse-junkmail headermatch 'X-Spam-Status: Yes'
which is activated by simply using the server-manager to redirect SPAM in email section.


Code: [Select]
^Subject.*[SPAM]
is a regex
so you are asking to redirect any email which has a header line starting with Subject and contain a S, a P , a A or a M somewhere after....

You might rather wanted to write this, but again this is of not use because there is another mechanism to do this:
Code: [Select]
^Subject.*\[SPAM\]and yet this one is better alone, because you could catch a subject like "Re: why is there [SPAM] in my subject":

Code: [Select]
^X-Spam-Status: Yes
« Last Edit: August 28, 2017, 09:27:13 PM by Jean-Philippe Pialasse »