Re: Maildrop handling subject containing unicode characters
Sam Varshavchik <[email protected]> Wed, 07 Sep 2022 18:21:09 -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.
--===============3980501471519466176==
Content-Type: multipart/signed;
boundary="=_monster.email-scan.com-130976-1662589269-0001";
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-130976-1662589269-0001
Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Milan Obuch writes:
> Hi,
>
> recently I found a problem in maildrop when handling subject containing
> unicode characters. Occasionally, I am experiencing mail not being
> delivered to some remote server with error message being (last line)
>
> 553 Unable to deliver Unicode E-mail to a non-Unicode mail server.
>
> After some investigation I found it comes from my maildrop script doing
> some kind of mailing list, and now I have a simple test case.
>
> I added to my maildrop script (another mailbox, so I can test things
> without disturbing my application) following:
>
> if (/^Subject: *(Test .*)/)
> {Subject=3D$MATCH1
> echo "subject $MATCH1"
> xfilter 'reformail -i"Subject: $Subject"'
> }
>
> This should just check for subject starting with Test to invoke some
> action, replacing the subject with new subject, constructed, but for
> this example it should be the same.
You can write
/^Subject:.*(<some unicode character>)/
and it'll match the subject line whether its unicode characters were =20
encoded, in UTF-8 or any other encoding.
Your maildrop script can expect to see only Unicode content, and should u=
se =20
UTF-8.
> It is now understandable that mail with subject mangled this way could
> be rejected by some external mail server. Mostly it works, but this is
> just kind of happy accident, given the spec.
>
> My question is, how should this be handled correctly. If I understand
> what happens, $MATCH variable contains matched text in internal Unicode
> binary encoding, and it should be encoded back using either base64 or
> quoted printable character encoding, if some non ASCII characters are
> in string given.
>
> Any hints appreciated...
You can use reformime to reencode unicode back into ascii-only:
$ reformime -o 'H=C3=B3la!'
=3D?UTF-8?B?SMOzbGEh?=3D
So, you probably want something like:
Subject=3D`reformime -o "$MATCH1"`
and, with everything else, it should work.
maildrop does not do variable substitution inside backticks, so this comm=
and =20
gets passed directly for execution to the shell, and it safely substitute=
s =20
$MATCH1, from the inherited environment.=20
Note that, either way, changing the subject line will likely break any =20
signatures that include the original subject line.
--=_monster.email-scan.com-130976-1662589269-0001
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEMWrVnbBKLOeG9ifkazpiviedvyUFAmMZGVUACgkQazpivied
vyVUrRAAtiTyk3yW8L1IPJhVKVCGVow/rIXblGMTrFHfI79nmkp396yGZUaspKwp
YnneNYocZ4uX4b1VoRipjBRHHF6sudPWLFevxhP8VbANjKy2BYXZvpxNhTQ0FXhZ
ZBw4j6ODQ5MWYrdbiugR9dlYqt3CADuLrCOW1FwhO5HtdYRclTBqRXME963quMuJ
USpc7AvnCRsEgrZVlYHVGAV6JmWcu0vvpArxDfcyeOCufV+kePRmBkh7g0/kLgJ0
D/7SSSGKcuWTvgdaCXsqibBidWRQpGouCDdDn8fHhCAOiPlxpx1JuvVNAIPn54ho
upo2bxYLw16+GXaW024IDUR24AWpPr4LT+aPIP+hIqsH5jk9cScODtzT686xSv8X
KcNUVnlMc7JC57yts4A6aerswQ2T9Hvj08KcVeXwM4h2ok+Ap+4ZCBmkSDdZji3y
EuUy3w11BrufmKT2eeYXRylGy0fBy9iW0tgkgya5EV6FrDJPiR5v0bP7C3q5BTjl
egHbspdmFOaL7Wh0SZvGPoQfPP56dusenSueI22TIvlM6MWt+UDx2O+KrTFVMCvE
SG/t5WAVxPsFfqcWYxGMjp7CEMntfTQWCRKfvu6NNqpWK368lChaHA+PSHURu2NO
Nu5hezDoZUjtjU6NRl5MoBXHm1XJ8W0dTM4HE+VLedlsz732Azs=
=TeYp
-----END PGP SIGNATURE-----
--=_monster.email-scan.com-130976-1662589269-0001--
--===============3980501471519466176==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============3980501471519466176==
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
--===============3980501471519466176==--