I have Postfix installed and configured to pass mail to Procmail. I have Procmail configured to pass the email to a Python script. I also notice that Procmail is placing a copy of the same email into a file at /var/spool/mail/<username>
. I don't want a copy of the message to be retained there or anywhere on the server. Is there a way to configure Procmail to drop the message after it is sent to the Python script?
In my .procmailrc configured like so:
:0Wc:
| env python3 /home/user/python/script.py
:0
* ^From:.*@.*
/dev/null
This however does not work. The message still ends up /var/spool/mail/<username>
.
/dev/null
regardless of the outcome of the first. If it didn't, there is an error somewhere, but without seeing Procmail's log file, it's impossible to say more. Perhaps see also iki.fi/era/mail/procmail-debug.html^From:.*@.*
looks like you are desperately trying to match all messages, but if that's the case, taking it out will match even the ones which don't have aFrom:
header with a@
somewhere in it. (Also, the trailing.*
is superfluous.)