forwarding - Procmail sends an extra email -
i use procmail forward 'from' gmail account
/home/user/.procmailrc
:0c * !^from_mailer * ^from: .*aaa | bbb | ccc.* ! ^x-loop: user@gmail\.com | formail -k -x "from:" -x "subject:" \ -i "to: user@gmail.com" \ -i "x-loop: user@gmail.com" :0 * ^from: .*aaa | bbb | ccc.* $default
this works fine on server inbox 'undelivered' mail
the mail system <"^x-loop:"@my-name-server.com> (expanded <"^x-loop:">): unknown user: "^x-loop:"
how can avoid this?
i've tried delete these mails. not best way.
anyway not work.
:0b * <"\^x-loop:"@my-name-server.com> /dev/null
the recipe contains multiple syntax errors, bounce message comes because lack asterisk on 1 of condition lines, makes action line instead.
the general syntax of procmail recipe is
:0flags # "prelude", optional flags * condition # optional, can have 0 conditions * condition # ... action
the action
can mailbox name, or !
followed destination mailbox forward message to, or |
followed shell pipeline.
so first recipe "if not mailer , matching from: ..., forward ^x-loop:
.
the | formail ...
line after syntax error , ignored, because needs come after prelude line :0
, (optionally) condition lines.
additionally, ^from:
regex wrong. match from: .*aaa
or bbb
(with spaces on both sides, in header, not from:
header) or ccc
.
finally, intent apparently forward resulting message somewhere.
:0c * ! ^from_mailer * ^from:(.*\<)?(aaa|bbb|ccc) * ! ^x-loop: user@gmail\.com | formail -i "x-loop: user@gmail.com" | $sendmail $sendmailflags user@gmail.com
if want forward incoming message, other -x
, -i
, -k
options superfluous or wrong. if accomplish irrelevant question, maybe need add or of them (and remember extract -x
new headers add -i
, otherwise suppressed; sucks).
your second recipe superfluous, unless have more procmail recipes later in file should bypassed these messages. (if so, need fix from:
regex there well.)
Comments
Post a Comment