Re: Some queries regarding MHonArc.

1999-04-20 13:56:14
On April 20, 1999 at 12:51, someone wrote:

I'm implementing a web based mail server for our internal mail server,
so that people from outside our organisation are able to access internal
For this I've designed a program which calls POP3 functions at the back
end. Everything is working fine except for attachment handling.
So, for this I want to make use of MHonArc utility.
I went through the code but as it includes numerous modules, its
becoming difficult for me to pick out the exact code which handles
just attachments. So, I'ld like your help in this regard.
To be specific, I just need to know the modules which take a mail body
and parse the attachments (if any are there), and give back the result
in html form.

There are several files responsible for converting a message into
HTML. has the core mail parsing routines and then there
are few other libraries for handling the conversion of various
content-types into HTML.  The MIMEFILTERS resource page lists the
various filter functions.

Note, if all you require is the conversion into HTML functionality,
you can use mhonarc in -single mode.  Example:

    mhonarc -single mesg.822 > mesg.html
    cat mesg.822 | mhonarc -single > mesg.html

You can also embed -single capability into a Perl program.  The
best way depends on your requirements, but the following is a

    require '' || die qq/ERROR: Unable to require ""\n/;
    mhonarc::initialize();  # only need to call once
    if (!mhonarc::process_input('-single')) {
        ## An error occured.  $mhonarc::ERROR contains the error message
        ## and $mhonarc::CODE contains the status code.  When there is
        ## an error it is non-zero and suitable as an argument to exit().

The mhonarc::process_input() function takes argument just like the
command-line options.  If you want to specify an input file (ie.
do not use standard input) then do something like the following:

    mhonarc::process_input('-single', 'mesg.822');

If input is coming from a filehandle, you can do the following trick:

    open(STDIN, "<&INFILE") || die "Unable to dup filehandle: $!";
    die $mhonarc::ERROR  if $mhonarc::CODE;

If no arguments are passed to mhonarc::process_input(), then
@ARGV is parsed.


             Earl Hood              | University of California: Irvine
      ehood(_at_)medusa(_dot_)acs(_dot_)uci(_dot_)edu      |      Electronic 
Loiterer | Dabbler of SGML/WWW/Perl/MIME

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Some queries regarding MHonArc., Earl Hood <=