0

I have no previous experience with procmail. I have written a filter to repair broken headers in certain emails that I receive. I need to set up my .forward file to run the repair filter without breaking the existing email processing.

Let's say that the current .forward file is

|IFS=' ';exec /usr/local/bin/procmail #username

Would I add another line above it in the file, or would I interpose the filter in the existing line like

...exec filter | /usr/local/bin/procmail #username

EDIT: I don't think that the single-line process would work, because the file in the .maildir/cur would still be bad. I need to modify that file, preferably as it lands in ./cur.

Peter L.
  • 63
  • 4

1 Answers1

0

Just run the filter immediately at the start of your .procmailrc. One of the important features of Procmail is that it make this (comparatively) easier and safer than doing voodoo directly in your .forward (which isn't portable between MTAs and platforms anyway; yours looks like a legacy Sendmail one, but who knows).

:0fw
| filter

Procmail typically runs before anything is written to Maildir/cur but this also depends on what exactly invokes Procmail and how.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • As an aside, I don't think you want `exec` at the start of a pipeline, but I could be wrong. – tripleee Oct 09 '18 at 17:12
  • A traditional Sendmail `.forward` would have Procmail deliver in a regular Berkeley mbox, not a Maildir; but maybe it has evolved since I last touched Sendmail. Most modern sites prefer Postfix. – tripleee Oct 09 '18 at 17:19
  • I'm ignorant of procmail. Does the filter simply have to output to stdout, and that version of the file will continue processing, or does the filter have to find the incoming file and replace it? – Peter L. Oct 15 '18 at 13:29
  • It's purely a Unix filter; stdin to stdout. – tripleee Oct 15 '18 at 13:46
  • Simple, then. Thank you! – Peter L. Oct 15 '18 at 18:03