Thursday, October 17, 2024

Re: Email Rendering Utility

On 2024/10/17 11:56:31 -0500, "Robert B. Carleton" <rbc@rbcarleton.net> wrote:
> I've been hunting around for some kind of utility that I can use from
> mail(1) that can be fed emails on the stdin and convert MIME, TNEF,
> HTML, and the like into text. I haven't had much luck finding that kind
> of thing. I'm familiar with mpack from packages, but I'm looking for
> something that can handle a wider range of input. Any suggestions?

There's (was?) someone on tech@ trying to fiddle with mail(1) to handle
MIME and whatnot, not sure if they got to the part of decoding too.
There are also some thirdy part version of mail(1) that I *believe*
handle MIME (both in composing and when reading.)

Otherwise, I can suggest mshow(1) from the mblaze package. It can read
a mail from standard input and render it nicely, as well as allowing you
to extract one of its parts (either the attachments or inline). You
could run it as

$ mail
[...select a mail...]
& !rm mail
& s mail
& !mshow ./mail
[...contents of the mail nicely formatted...]
& !mshow -t ./mail
[...list MIME parts...]
& !mshow -x ./mail N
[extracted part N from ./mail]

(I'm not an heavy user of mail(1) so probably there's a better way to do
this.)

At this point however switching away from mail(1) and embracing mblaze
is probably easier ;-)

HTH

No comments:

Post a Comment