From: Walter Alejandro Iglesias Subject: mail(1) patches (UPDATE) To: tech@openbsd.org Date: Fri, 26 Jul 2024 20:40:19 +0200 Update[1]: https://en.roquesor.com/Downloads/mail_patches.tar.gz I've been reading more carefully the standards. According to rfc6532, headers can be sent directly in UTF-8, so I ended up discarding the functions I'd written to base64 encode-word the Subject (shedding some tears, this gave me a lot of work.) With that, it also went away my base64 folding function (you can't insert new lines in base64 arbitrarily.) At least, this was a step forward regarding to what I was told, that my diffs are too large. But, even when rfc6532 says that now the 78 columns folding is not longer mandatory, just cosmetic, lines are still restricted to 998 octets, which leads us to speculate the following. Nobody needs a 998 octets Subject and even when some MUAs or MTAs generate extremely large Message-IDs, which get accumulated in References (another header I added to mail(1), along with Date,) you need a 20+ thread tree to exceed that limit. To fold or not to fold, that's the question. :-) There already is a fmt() function included in send.c, seems to be intended for To, Cc, and Bcc headers (defined as struct.) So, I wrote a new function to fold headers defined as char strings with UTF-8 support, for now I used it to fold Subject and References. I mean there's the option of ignoring this restriction (what can happen is that the MTA refuses to send the mail throwing an error,) with that I could also remove this new folding function, further simplifying my patches. Any advice? *** (1) For the newcomers (content of ABOUT file included in the tarball): These patches teach mail(1) to generate some headers to comply with standards and to add necessary functionality. Some of them, when not generated by the MUA are added by the MTA, but it's desirable the MUA do this so that those headers are also present in the copy of the outgoing messages that your MUA saves locally. This patches cannot be applied consecutively. date.diff Generate User-Agent and Date. id.diff Generate Message-ID, In-Reply-To, References. Fold Subject and References at 72 columns. mime.diff Generate MIME_Version, Content-Type and Content-Transfer-Encoding. If non valid UTF-8 is detected in the body MIME headers are not generated. all.diff Including all the above.