MHonArc Resource List




M2H_ARCHIVE= [ 0 | 1 ]



Command-line Option(s)



MHonArc using the ARCHIVE resource to determine if it should create archive data after reading message data.

Default Setting


Resource Variables



The purpose of MHonArc is to create HTML archive, so why would you want to disable archiving? One potential purpose is to use MHonArc as a general MIME processing filter to extract all attachments in a mail folder to separate files. To do this, you can define a resource file as follows:

<MIMEFilters override>
<MIMEArgs override>
m2h_external::filter; usename

For this example, let's assume this resource file is called .mha-attach.mrc and it exists in your home directory.


You notice that we set the "usename" option to the external file filter. Our intent is to be able to save attachments with the filename specified in the message. If you do not want this, you can remove the MIMEARGS resource setting. This will cause the attachments to be saved to a unique filename with an extenstion based upon sub-type is generated.

Now, you can create a shell alias (assuming Csh syntax) as follows:

alias save-attachments 'mhonarc -noarchive -rcfile ~/mha-attach.mrc \!*'

So, if you want to extract all attachments to a mail folder called "inbox" with all attachments saved to ~/tmp, you would enter the following at your shell prompt (%):

    % save-attachments -outdir ~/tmp inbox

Extraction of all attachments from a mail folder maybe more than you need. You may want to just do a single message. Although the following example has nothing to with the ARCHIVE resource, it is related to using MHonArc as a MIME processing tool.

To processing a single message, we can use the same resource file listed above. The difference is how we invoke MHonArc. If you have the message in a file, you can do the following:

    % mhonarc -rcfile ~/mha-attach.mrc -single message.822 > /dev/null

Where message.822 is the file containing a single message. The redirection of standard output to /dev/null is done to discard the HTML message text data since all we care about are the attachments saved.

I use MH, and the version I have does not support filenames defined for attachments. Hence, I have the following (Csh) alias in my .cshrc file to store all parts of a message to disk utilizing the filenames defined in the message:

alias store     'show -noshowproc -noheader \!* | \\
                mhonarc -rcfile ~/dotfile/.mhonarc.attach.mrc -single  \\
                > /dev/null'

The resource file ~/dotfile/.mhonarc.attach.mrc is the same as mha-attach.mrc in the previous examples.

If you have a MUA that does not support MIME, or the support is minimal, you can use MHonArc as shown to decode and save attachments.



See Also

98/09/27 16:56:01
Copyright © 1998, Earl Hood,