I know. I know. But In my case it doesn't matter. really. And I am not able
to make it better .. :-)
I don't know how to write a script, which can go through message to change
ONLY FIRST word "Subject" and let rest like it is without a change ...
And email to this specific recipient will be send in Czech language, so
there should be no any other Subject .. :-)
Can anyone know how to make a better filter ? How to change the right
subject only in the header of the message ?
header_checks - know how to make it, but for only one user a need this and
header_checks can not handle this.
maildrop - can not change any subject to another and even if mialdrop know
this, so I have to replace maildrop like the MDA, but I use dovecot for
this, why another monster application ...
dovecot sieve - can not change subject , can lot of things but not this ...
Can be header_checks used somehow like a filter ? To set up postfix access
to use specific header_checks for ONE exact recipient only ????
Use reformail. it comes with maildrop.
...
reformail=/path/to/reformail
cat | $reformail -R Subject: X-Subject: -A "Subject: SPEDICE" > in.$$
...
This will rename the original Subject header and appends a new one.
> header_checks - know how to make it, but for only one user a need this and
> header_checks can not handle this.
> maildrop - can not change any subject to another
in mailroprc, you need to use reformail as shown above.
> and even if mialdrop know
> this, so I have to replace maildrop like the MDA, but I use dovecot for
> this, why another monster application ...
> dovecot sieve - can not change subject , can lot of things but not this ...
>
> Can be header_checks used somehow like a filter ? To set up postfix access
> to use specific header_checks for ONE exact recipient only ????
only if you are willing to run a dedicated smtpd for that recipient...
Not work .. It totally destroy incoming email ... :
Return-Path:
Received: by game.centel.cz (Postfix, from userid 1011)
id 6713C51610; Mon, 5 Nov 2007 21:52:58 +0100 (CET)
Message-Id: <200711052052...@game.centel.cz>
Date: Mon, 5 Nov 2007 21:52:58 +0100 (CET)
From: fr...@from.cz
To: undisclosed-recipients:;
This works:
/usr/local/bin/reformail -R Subject: X-Subject: -A "Subject: SPEDICE"
<test.message
but not perfect ..
1. change subject (ok)
2. If X-Subjcet is not present in original message, so it will create
X-Subject WITH orig. subject ! (wrong)
:-( Mayby I slould try to make a dedicated smtpd for that client .....
But I must learn how .. :-)
Thanks Peter
I was referring to the first cat, the one that writes the message to in.$$:
# Start processing.
cd $INSPECT_DIR || {
echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
cat >in.$$ || {
echo Cannot save mail to file; exit $EX_TEMPFAIL; }
do you see it?
> But when I use it in the filter , change will not happen ... Grrr. Why I
> can not ANY scripting language ?....
>
> Here is the full script:
>
> #!/bin/sh
>
> # Simple shell-based filter. It is meant to be invoked as follows:
> # /path/to/script -f sender recipients...
>
> # Localize these. The -G option does nothing before Postfix 2.3.
> REFORMAIL=/usr/local/bin/reformail
> INSPECT_DIR=/var/spool/filter
> SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.
>
> # Exit codes from <sysexits.h>
> EX_TEMPFAIL=75
> EX_UNAVAILABLE=69
>
> # Clean up when done or when aborting.
> trap "rm -f in.$$" 0 1 2 3 15
>
> # Start processing.
> cd $INSPECT_DIR || {
> echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
>
> cat >in.$$ || {
> echo Cannot save mail to file; exit $EX_TEMPFAIL; }
>
> # Specify your content filter here.
> cat | $REFORMAIL -R Subject: X-Subject: -A "Subject: SPEDICE" < in.$$ || {
> echo Message content rejected; exit $EX_UNAVAILABLE; }
> $SENDMAIL "$@" <in.$$
>
1- what's this "cat" for?
2- you are reading in.$$, modifying it in memory, and the modifications
are lost after exit!
> exit $?
>
>
>>> but not perfect ..
>>>
>>> 1. change subject (ok)
>>> 2. If X-Subjcet is not present in original message, so it will create
>>> X-Subject WITH orig. subject ! (wrong)
>> This was intentional (I don't like removing headers!). just remove the
>> -R part and use -U.
>
> OK. OK. I see
>
> Thanks Peter
>
>
>
>
Yeah !!! I have forgotten, that reformail works a little bit different than
sed.
So I have removed first cat and now filter works perfect ...
THANKS very much for your help and for the time that you have to spend with
me ... :-)
Thanks a lot ... :-)
Bye Peter ....
Can you or somebody else post the entire solution? The script, the
changes in postfix, etc.
I would appreciate.
thks
paiva