Re: Maildrop handling subject containing unicode characters

Sam Varshavchik <[email protected]> Fri, 09 Sep 2022 18:48:47 -0400
Newsgroups gmane.mail.maildrop
Message-ID <[email protected]>
This is a MIME GnuPG-signed message.  If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.

--===============1727496515828904746==
Content-Type: multipart/signed;
    boundary="=_monster.email-scan.com-233325-1662763727-0003";
    micalg=pgp-sha1; protocol="application/pgp-signature"

This is a MIME GnuPG-signed message.  If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.

--=_monster.email-scan.com-233325-1662763727-0003
Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Milan Obuch writes:

> Unfortunately, it does not work for me.
>
> My snippet coming into action:
>
> if (/^Subject: *(Test .*)/)
>  {Subject=3D`reformime -o "$MATCH1"`
>   echo "subject $MATCH1 -> $Subject"
>   xfilter 'reformail -i"Subject: $Subject"'
>  }
>
> Mail sent with subject 'Test =C4=BE=C5=A1=C4=8D=C5=A5=C5=BE', encoded f=
orm is
>
> Subject: Test =3D?UTF-8?B?xL7FocSNxaXFvg=3D=3D?=3D
>
> (end of) line in log from echo statement above produced is
>
> subject Test =C4=BE=C5=A1=EF=BF=BDM-^M=C5=A5=C5=BE -> Test
>
> (letter =C4=8D is not properly displayed here, which could be different
> issue) and mail being delivered has subject Test. Pure ASCII, no UTF-8,
> neither raw nor encoded.

I think it's just a simple environment issue. When I ran a manual test, I =
got:

$ maildrop filter <msg
bash: line 1: reformime: command not found
subject Test =C4=BE=C5=A1=C4=8D=C5=A5=C5=BE =E2=86=92

That's because reformime is over here:

$ which reformime
/usr/lib/courier/bin/reformime

Which is not in the default PATH. And after changing to explicit, absolut=
e =20
paths:

$ cat filter
if (/^Subject: *(Test .*)/)
{
    Subject=3D`/usr/lib/courier/bin/reformime -o "$MATCH1"`
    echo "subject $MATCH1 =E2=86=92 $Subject"
}
exit

The end result was as expected:

$ maildrop filter <msg
subject Test =C4=BE=C5=A1=C4=8D=C5=A5=C5=BE =E2=86=92 Test =3D?UTF-8?B?xL=
7FocSNxaXFvg=3D=3D?=3D

And the final test:

if (/^Subject: *Test (.*)/)
{
    Subject=3D`/usr/lib/courier/bin/reformime -o "$MATCH1"`
    echo "subject $MATCH1 =E2=86=92 $Subject"
    xfilter '/usr/lib/courier/bin/reformail -i "Subject: $Subject"'
}
to "/tmp/msg"

result in

Subject:  Test =3D?UTF-8?B?xL7FocSNxaXFvg=3D=3D?=3D

turning into

Old-Subject:  Test =3D?UTF-8?B?xL7FocSNxaXFvg=3D=3D?=3D
Subject: =3D?UTF-8?B?xL7FocSNxaXFvg=3D=3D?=3D


--=_monster.email-scan.com-233325-1662763727-0003
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEMWrVnbBKLOeG9ifkazpiviedvyUFAmMbws8ACgkQazpivied
vyX93g/5AS8n/fPK2ZSOUYU3JROxk6uJEyRw1bJQVS1b5LPa026nGmAtrNX5tqCu
vtH7z1jO6SpY8XkIknf7IJTmzoHihjdU4J+UJ1AcX9F0MYMtNeJOFaXbGpI6zEOc
xxRhti/1zjacZMaViwNM+rC3jwVyyEJVGFbR50AMnK+aNvsJzCCVRlzFSnqH5LVC
XmfCmbYzPXrP3/ZJg7Cuxko5A2eTP26FN8QUjdzphDdzFdy5qJ29oOmKGv3wJqSj
yITT/PhBpVTUaHZZ3Qmh9j+YKRiZQ62Me++HyCdQsxE+rdBwPOuIx2bKG3OfLqg6
EodVw18cubR+sH4kQh2iJ9Vm7mhtA4toBgb8XAeLq0vrKNnJFJgehuO5ipbp4QI2
7J5f7ZukiTV/kOQWAPJNBrzUdLgbXVDYx+ftbq86/e+we4T5CZoDc0IFvqx5PhTC
trJ1Uv+hZFYpXE8OAVqUnjutWLCEPrQR4QRBkUvilN8wP2drwaBuExhVY9iar+L1
EzrnVRCwngQFjpKdD4W2Cbfp2zLKIOkxrcClDFZCprCoDk9OXSQVMeMZr6gJTH/8
YqoZNEJzTSWKjDC4WmC0P2PwQbySwtFxMYXhnaA+GM6d4JJDXts/NCUaiEmSh5Ho
eh4/Ug+EN/uGfqyfcsCwuH6wo3Xs3fM13S5dwu7fQw9mq7HDpW4=
=lxZG
-----END PGP SIGNATURE-----

--=_monster.email-scan.com-233325-1662763727-0003--


--===============1727496515828904746==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============1727496515828904746==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Courier-maildrop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/courier-maildrop

--===============1727496515828904746==--