Re: MIME in a mail message

1997-11-11 16:55:56
I'm using /usr/bin/mailx to pipe a html file from a script into Mhonarc.
I'm sticking Content-Type:text/html into the body of the
message right at the top.  Mhonarc is ignoring this, so I'm guessing 
that it is looking for the Content-Type: text/html in the
header and not the body.  Anyone know how to get that into
a header in mailx from the command line? Or am I formatting
something wrong?

If you only do the pipe to mhonarc for html messages that
are not typed properly, you can create a custom resource file
that maps the text/plain type to the HTML filter to get what
you want.

If you pipe other types of message, I am not familiar with mailx,
so I do not know how the piping functions in mailx.  If you are
able to pipe a message (with its header) to an external process,
the external process can be custom front-end to mhonarc to
add the "Content-Type: text/html" to the header before piping
the data to mhonarc.

Here's a simple Perl program that could work (code not tested):

    $ctype = shift @ARGV;
    open(MHONARC, "| mhonarc -add -outdir /my/archive") or die;
    while (<>) {
        if (/^$/) {     # End of header
            print MHONARC "Content-Type: $ctype\n\n";
            last;       # Break out
        print MHONARC $_;
    while (<>) { print MHONARC $_; }

Change the options to mhonarc in the open call to suit your
needs.  You specify the content-type value as the first argument
to the program.  Message input can come from stdin or as a
filename on the command-line.


<Prev in Thread] Current Thread [Next in Thread>