> Fixing the mail requires headers like:
>
> MIME-Version: 1.0
> Content-type: text/plain
> Content-transer-encoding: 8bit
>
> Wietse
It is working now. I fixed the header externally with formail (can't
Postfix do that without external help?)
I post my solution here for future references. Also any suggestions
for improvements are welcome.
#master.cf
smtp inet n - n - - smtpd
-o content_filter=filter:dummy
sevenbit unix - - n - - smtp
-o smtp_never_send_ehlo=yes
filter unix - n n - 10 pipe
flags=Rq user=nobody argv=/path/to/my.filter -f ${sender} -- ${recipient}
###############################
#transport
[EMAIL PROTECTED] sevenbit:[my.relayhost]
[EMAIL PROTECTED] sevenbit:[my.relayhost]
[EMAIL PROTECTED] sevenbit:[my.relayhost]
[EMAIL PROTECTED] sevenbit:[my.relayhost]
###############################
#!/bin/sh
# my.filter
# Meant to be invoked as follows: /path/to/my.filter -f sender recipients
INSPECT_DIR=/tmp/filter
SENDMAIL="/usr/sbin/sendmail -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.
mkdir -p $INSPECT_DIR
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.
formail -a "MIME-Version: 1.0" -a "Content-Type: text/plain;
charset=utf-8" -a "Content-Transfer-Encoding: 8bit" <in.$$ > out.$$ ||
{
echo Message content rejected; exit $EX_UNAVAILABLE; }
$SENDMAIL "$@" <out.$$
exit $?
##########################################
2 doubts
-When [EMAIL PROTECTED] is matched the conversion occurs,
Content-Transfer-Encoding becomes quoted-printable as expected, but
Content-Type is not changed (charset=utf-8 stays there). I guess this
is innocuous.
-As seen above, in my transport file I do need to specify my relayhost
in every line or otherwise mail is delivered locally. I should not be
required to set again since it is already in main.cf. Am I doing
something wrong? I presume I might need a minor change in the
master.cf
Once this is polished I will try to use the advanced content filter
solution using a second port.
Thanks, RC.