Hi Karl, > Hi Sergey (and all) - does mailutils provide utilities along the lines > of mpack and munpack to create or read mime messages?
Yes, of course. Basically, all utilities the package provides are mime-aware. However, most of them operate on messages in mailboxes, not on messages already extracted as files, so there's no direct equivalent of munpack. Let's start from mpack, though. The basic functionality of mpack is available using the 'mail' tool. For example, the following invocation: mpack -s subject -d DESCRFILE -c TYPE FILE ADDRESS is supposed to send file FILE to email ADDRESS with content-type set to TYPE and the contents of the file DESCRFILE preceding it in another MIME part of type text/plain. To do this using mailutils, run mail -s subject --content-type=TYPE --attach=FILE \ --content-type=text/plain ADDRESS < DESCRFILE (sending multipart messages using mail is covered in detail in http://mailutils.org/wiki/Mail:_sending_attachments) The mpack's -o option directs its output to a file, instead of sending it. This functionality can be achieved using /usr/bin/cat as a mailer: mail --exec 'set sendmail=/usr/bin/cat' \ -s subject --content-type=TYPE --attach=FILE \ --content-type=text/plain ADDRESS < DESCRFILE > OUTFILE As a result, OUTFILE will contain a formatted email message ready to send. The two options of mpack that have no direct equivalents are -m (set splitsize) and -n (post the message to NNTP groups). As to the latter, it cannot be directly implemented in mailutils and I doubt it will be worth while, given the present state of decline of NNTP. The -m option, however can be easily implemented. The same 'mail' tool can be used to extract MIME parts from a message. The 'decode' command does this. For example, the command 'decode 4[2]' issued from the mail shell decodes the MIME part #2 from the message #4. Decoding is governed by the part's content-type and the action assigned to that type in mailcap file. Another utility available for manipulating MIME files is mhn from the mh sub-package. > However, I probably shouldn't be asking the above; it just seemed like a > good idea. Why not? Both tools would be quite easy to implement. > What I actually want is something that I think munpack does > not do: given a msg with text/* base64-encoded parts, undecode them to > stdout, leaving the msg otherwise unchanged. I like the idea. Allow me some time to muse upon it. I'll be able to propose something working by the end of this week, I guess. > P.S. At https://www.gnu.org/software/mailutils/mailutils.html#documentation > "TeXinfo" should be "Texinfo". Fixed it. Thanks for noticing. > P.P.S. stylistically, the font size is being reduced on that web page > for no reason I can discern. Compared to, e.g., > https://www.gnu.org/software/autoconf or automake, which use the font > specified by the user (me). Yes, indeed. Looking at that page I think I'd be better off redirecting it to https://mailutils.org instead. It doesn't say anything new and maintaining both versions is a waste of time. What do you think? Best regards, Sergey