LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   .procmailrc not working (https://www.linuxquestions.org/questions/linux-server-73/procmailrc-not-working-4175709914/)

mfoley 03-24-2022 09:55 AM

.procmailrc not working
 
I have the following rule in .procmailrc:
Code:

:0:
* ^From:.*@p.backcountry.com
* ^From:.*@emails.wyndhamhotels.com
* ^From:.*@thermoworks.com
* ^From:.*web@jbcovertlodge.com
* ^From:.*24hourwristbands.com
/user/mfoley/mbox.deleted

Email for these seems to keep getting through. For example, for info@p.backcountry.com the mail header is:
Code:

To: mfoley@novatec-inc.com
Date: Thu, 24 Mar 2022 11:46:41 +0000
Subject: Our Favorite Road Trip Gear
From: "Backcountry" <info@p.backcountry.com>

And procmailrc.log has:
Code:

procmail: [20302] Thu Mar 24 07:46:49 2022
procmail: Assigning "LASTFOLDER=/usr/sbin/sendmail -oi droid"
procmail: Unlocking ".lock"
procmail: Locking "/var/mail/mfoley.lock"
procmail: Assigning "LASTFOLDER=/var/mail/mfoley" 
procmail: Opening "/var/mail/mfoley"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/mail/mfoley.lock"
procmail: Notified comsat: "mfoley@279108431:/var/mail/mfoley"
From bounces+mfoley=novatec-inc.com@p.backcountry.com  Thu Mar 24 07:46:47 2022
 Subject: Our Favorite Road Trip Gear
  Folder: /var/mail/mfoley                                                36393

Normally in the procmailrc.log I see "Match on" or "No Match on" statements, but nothing like that for backcountry.com, and the messages continue to be delivered to my inbox, /var/mail/foley instead of /user/mfoley/mbox.deleted as specified in the rule.

I have 60 rules in my .procmailrc, most of which work fine. I don't know what I'm doing wrong on this one.

bathory 03-24-2022 11:51 AM

Hi mfoley,

Quote:

I have the following rule in .procmailrc:

:0:
* ^From:.*@p.backcountry.com
* ^From:.*@emails.wyndhamhotels.com
* ^From:.*@thermoworks.com
* ^From:.*web@jbcovertlodge.com
* ^From:.*24hourwristbands.com
/user/mfoley/mbox.deleted
This is not going to happen because procmail uses logical AND to match conditions, so with the above notation all 5 "FROM:" conditions must be met.

You should use the a logical OR (symbol |) if you want your rule to be executed every time you get an email from one of these 5 email addresses:
Code:

:0:
* ^FROM:.*(p.backcountry.com|emails.wyndhamhotels.com|thermoworks.com|web@jbcovertlodge.com|24hourwristbands.com)
/user/mfoley/mbox.deleted


Regards

mfoley 03-25-2022 10:18 PM

bathory: Yup! That did it. In fact I do have other rules with "or" conditions, I guess I just forgot how. Not only that, but I asked this question some time ago: https://www.linuxquestions.org/quest...rc-4175609345/, but completely forgot it. If I had searched on "procmailrc or condition" that solution would have turned up. Duh!

Thanks!


All times are GMT -5. The time now is 04:22 PM.