# Quick Start

This section gives you a "quick start" on using MHonArc.

- Converting mail
- Adding Messages to an Archive
- Converting a single message

## Converting mail

MHonArc supports MH mail folders and UUCP/Unix mailbox files, so the term "mail folder" represents the MH mail folder or mailbox file to process. To convert a mail folder to an HTML archive, use the following:

    prompt> mhonarc path/inbox

Where path represents the directory path containing the mail folder inbox. If you are in the directory that contains inbox, you can leave out the "path`/`".

You can specify multiple mail folders to process:

    prompt> mhonarc path/inbox1 path/inbox2 ...

You can also specify standard input, "`-`", as the source of mail folder:

    prompt> mhonarc -- - path/inbox

The "`--`" (two hyphens) is required to terminate command-line option parsing so "`-`" is not treated as the start of an option. The example also illustrates that you can specify regular mail folders along with standard input. In this example, MHonArc processes standard input and then `path/inbox`.

NOTE: | Mail folder data read in from standard input must be in UUCP-style mailbox format.

MHonArc creates the following files after processing the mail folders:

- `maillist.html`: The main index file containing links to all mail messages converted. Messages are listed with subjects and who the messages are from. All messages are listed in sorted order by date received/sent.

- `threads.html`: The file listing messages by thread.

- `msg*.html`: HTML versions of the mail messages, where`*` represents a message number from 0 to the number of message processed minus 1.

- `.mhonarc.db` (or `mhonarc.db` under Windows): This database file contains archive information and resource settings for MHonArc to perform further updates.

- Other: If messages contain attachments, other files may be created for images, videos, binaries, etc.

By default, all files created are put into the current working directory. You can control the location of archive files by using the `-outdir` option.

Example

    prompt> mhonarc -outdir /home/ehood/htmlarchive /home/ehood/mail/inbox

Here is a sample session converting a mail folder:

    prompt> mhonarc ~/mail/inbox
    This is MHonArc v2.6.0, Perl 5.006001 linux
    Converting messages to .
    Reading /home/ehood/mail/inbox ..........
    Writing mail ...
    Writing ./maillist.html ...
    Writing ./threads.html ...
    Writing database ...
    10 messages

By default, MHonArc prints out information about its progress. This can be disabled with the `-quiet` option.

## Adding Messages to an Archive

If you have new messages you want to add to an existing archive, you must utilize the `-add` command-line option. With the `-add`, you can do the following:

- Add mail folders, or
- Add a single message.

Adding a mail folder to an archive in the current working directory can be done like the following:

    prompt> mhonarc -add <path>/mailfolder

If you are not in the same directory as the archive, then you can specify the location of the archive with the `-outdir` option.

NOTE: | MHonArc skips any messages that already exist in the archive. Therefore, MHonArc can be used to rescan a mail folder to auto-find any new messages to add.

If no mail folders are specified, MHonArc attempts to add a single message read in from standard input.

Example

    prompt> mhonarc -add < single.msg

Or, from a pipe:

    prompt> cat single.msg | mhonarc -add

## Converting a single message

MHonArc converts a single mail message, independent of creating or modifying an archive, if the `-single` option is specified. The message to process is specified by filename, or piped in from standard input. The resulting HTML is sent to standard output.

Examples

Input from standard input:

    prompt> mhonarc -single < messagefile > file.html

Filename on command-line:

    prompt> mhonarc -single messagefile > file.html