Retention rule not working

Issue #621 closed
Uwe Kiewel created an issue

I have created following retention rules:

MariaDB [piler]> select retention_rule.from,days from retention_rule where id in (25,26);
+--------------------+------+
| from               | days |
+--------------------+------+
| ^newsletter.*$     |   30 |
| /^newsletter@.*$/i |   29 |
+--------------------+------+

relevant data in v_messages: MariaDB [piler]> select v_messages.from from v_messages where piler_id='40000000562f15d33ad10b84003bc8b4d1e2'; +---------------------------+ | from | +---------------------------+ | newsletter@news.tchibo.ch |

Log entry: Oct 27 07:12:26 mailarchiv piler[4842]: 40000000562f15d33ad10b84003bc8b4d1e2: from=journal@xxxxxxxxxx size=218430/40936, attachments=0, reference=, message-id=re-pPnYZxHQnds72ivubbGh1p-1FTQ400T-1FNKIAGP-CJQZI5@news.tchibo.ch, retention=36500, delay=0.07, delays=0.06/0.01/0.00/0.01/0.00/0.00, status=stored

Why is the default of 35600 days used and not 30/29 day as definied in the from-based retention rule?

Comments (10)

  1. Uwe Kiewel reporter

    so from-based retention rules are not working in Office 365 environment, due to the sender (from) is always from=journal@mydomain?

    if I look to the piler database, from is correct as stated in the description. from=newsletter@news.tchibo.ch

  2. Janos SUTO repo owner

    The 'from' based retention rules should work with o365 as well. The parser doesn't care about the envelope sender / recipient addresses (ok, it cares a little), rather it parses the email headers. However it processes the headers, so they may look a little bit different than you might think.

    Take such a message, and run pilertest against it to see what piler thinks about the message. Then compare the from: values with your rules. I suspect that you need a space right after ^. If it doesn't work, then show me pilertest output (the body is not interesting now).

  3. Uwe Kiewel reporter

    Ok, I got ist. The from line in the email header contains lot's of bullshit beside the email address. Based on the newsletter mail in the 1st post, the from line looks like:

    from: tchibo privatcard newsletter@news.tchibo.ch newsletter news tchibo ch (news.tchibo.ch)

    So, will ich check for "newsletter@" in the from I must not use ^newsletter in regex.

    I am not sooooo familiar with regex. What would you advice to cover the szenario "retention for newsletters is 30 days"?

    newsletter@ /newsletter@/ /^(.)newsletter@(.)$/

    any other?

    Thanks!

  4. Janos SUTO repo owner

    OK, then try to fix the from address in the retention_rule table simply to newsletter@news.tchibo.ch

    Then run pilertest again, and check if it's any better. Look for the retention related line.

  5. Log in to comment