Timothy Luoma asked,
| I've got a few friends whose full name doesn't appear when they
| send me email. I've been using this to fix it:
|
| :0
| *^Return-Path: <RobertA473(_at_)aol(_dot_)com>
| {
| :0fhwc
| | formail -I "From: Robert Austell <RobertA473(_at_)aol(_dot_)com>"
| }
|
| Is there a more efficient way?
Well, yes, but not where I think you expected to find it. For starters,
:0fhw
*^Return-Path: <RobertA473(_at_)aol(_dot_)com>
| formail -I "From: Robert Austell <RobertA473(_at_)aol(_dot_)com>"
`c' with `f' is extraneous, and in some older versions of procmail it will
cause an error message. In newer versions, if LOGABASTRACT=all, `c' on a
filtering recipe or a variable capture recipe will result in getting a log
abstract for the recipe, so there could be a reason to use it. I don't
know why you'd want an extra log abstract here, though, because the final
one will tell you that it was "From RobertA473(_at_)aol(_dot_)com [timestamp]"
anyway.
Because "<" and ">" are in $SHELLMETAS, there is a problem remaining:
that action line will spawn and unneeded shell. We get around that this way:
ORIGMETAS=$SHELLMETAS # save the value for later
SHELLMETAS # unset it so that "<" and ">" do not trigger a shell
:0fhw
*^Return-Path: <RobertA473(_at_)aol(_dot_)com>
| formail -I "From: Robert Austell <RobertA473(_at_)aol(_dot_)com>"
SHELLMETAS=$ORIGMETAS # restore default value
| What if I want to totally get rid of a header line like:
|
| X-SomeMeaninglessTripe:
|
| :0fhw
| * ^X-SomeMeaninglessTripe:
| |formail -I"X-SomeMeaninglessTripe"
|
| ?
Yes, exactly. But if there are several such headers you never want to see,
try to get rid of all of them at once if at least one is present:
:0 # if all three are missing ...
* !^X-SomeMeaninglessTripe:
* !^X-Piffle:
* !^X-Waste-Of-Bandwidth:
{ } # then do nothing, but
:0Efwh # otherwise (if even one is there), get rid of them
| formail -IX-SomeMeaninglessTripe: -IX-Piffle: -IX-Waste-Of-Bandwidth: