nmh-workers
[Top] [All Lists]

Using web browser mail agent as nmh message viewer

2002-07-27 08:27:25
Hi, all.  All this discussion about hacking nmh has gotten me
motivated to change my slacker's ;-) habits.  Before I became
a slacker, I used to always use MH/nmh to read and process mail
from the command line (from a shell prompt).  I love that
flexibility, and the shell is the way I like to get work done
in a hurry.  But, these days, I get so much MIME mail with
attachments... and nmh's MIME handling is so far from what I
need... that I've been using the Mozilla mail agent to make the
first cut at reading my mail, weeding out spam, etc... then
using a script to pull the messages I want to keep from my
Mozilla inbox into my nmh inbox, where I file them.  Until now.

I've decided to try going back to using nmh commands like show,
rmm, etc. as my first-pass mail interface... and to use Mozilla's
mail agent to display the MIME messages I want to see.  (I know
that I could also use exmh.  But I typically keep two main windows
open on my display: a tall terminal window and a stack of Mozilla
windows.  Also, Mozilla does a much better job of rendering web
pages, handling links, etc. than exmh [used to do].)  So I've
written a shell script (see below) named smoz ("send to Mozilla").  
It appends the specified message(s), or the current message, to a
Mozilla mail folder.  Then I can bring the Mozilla mail agent to
the top of my window stack (if it isn't already there) and click
on my "temp" local folder to see the messages that smoz appended.

The basic way this works is:

  $ next
  (Message inbox:123)
            (header appears)
  part 1     text/plain                 678
  Press <return> to show content...
  ^\        (kills "next" before displaying message)
  $ smoz    (sends message to Mozilla folder; click on folder and read)
  $         (now I can use rmm, refile, etc.)

This seems to work fine.  (BTW, the script doesn't append ^M to each
message line, as Mozilla seems to do for its other folders, but
Mozilla doesn't seem to care.)  I'm sending the script out in case it's
useful to anyone else, or in case anyone has comments.  I know that
this is sort of a kludge, but I think it's a good start.  Comments?

Jerry
jpeek(_at_)jpeek(_dot_)com

P.S.  You can get the path to your Mozilla "Local Folders" folder by
clicking on the folder and choosing the menu item "Edit -> Mail and
Newsgroup Account Settings".  BTW, I'm using Mozilla 1.1 beta.

------------------------------------------------------------------------
#!/bin/sh
# $Id: smoz,v 0.2 2002/07/27 15:12:05 jpeek Exp $
#
# smoz - send mail message(s) to Mozilla mail folder for display there
# Usage: smoz [messagenums]

# Absolute path of folder to append message(s) to
# (NOTE: Name has a space.  Watch quoting!)
# (NOTE: This may change with each new Mozilla installation!)
folder="/home/jpeek/.mozilla/default/y3kd03l3.slt/Mail/Local Folders/temp"

if [ ! -f "$folder" ]
then
    echo "`basename $0` ABORTING: can't find Mozilla folder (file)
    $folder"
    exit 1
fi

# Get absolute path(s) to message(s):
case "$#" in
0) msgs=`mhpath cur` ;; # No arguments; use current message
*) msgs=`mhpath "$@"` ;;
esac

# Make line like this:
#    From - Mon Apr 01 09:50:10 2002
dateline="From - `date +'%a %b %d %X %Y'`"

# Append messages; add "From " before and blank line after each one.
# Note that output of loop is appended to the folder to avoid multiple opens.
for msg in $msgs
do
    echo "$dateline"
    cat "$msg"
    echo
done >> "$folder"


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