lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "mailto:" + EXTERN wishlist [lynx-dev]


From: Klaus Weide
Subject: Re: "mailto:" + EXTERN wishlist [lynx-dev]
Date: Fri, 11 Jun 1999 02:44:38 -0500 (CDT)

On Thu, 10 Jun 1999, Michael Warner wrote:
> On or about 10 Jun, 1999, Louis-David Mitterrand
> <address@hidden> wrote:
> 
> > On Thu, Jun 10, 1999 at 02:41:41AM -0500, Klaus Weide wrote:
> > > For mailto links, EXTERN ('.') can be used:
> > > 
> > >     <http://www.flora.org/lynx-dev/html/month0299/msg00474.html>
> > 
> > That's nice. I just mapped:
> > 
> > EXTERNAL:mailto:mutt %s:TRUE ## mutt is a popular mail client under unix
> > 
> > It would be absolutely perfect if the "mailto:"; prefix did not appear
> > in %s and if the "subject?" field that can be added to mailto: links
> > would be passed as %S for example.
> 
> When in doubt, wrap it!

Yes.

> I've got:
> 
> EXTERNAL:mailto:${HOME}/bin/scripts/lxmail.sh %s:TRUE
> 
> where lxmail.sh is the very minimal:
> 
> #!/bin/sh
> #lxmail.sh called by lynx external for mailto:'s receives
> #'mailto:address@hidden' as it's argument, chops off the
> #'mailto:', and passes the address to an email program.
> ADD=`echo $1 | cut -f2 -d:`
> ${HOME}/bin/mutt ${ADD}
> 
> , and I imagine some modification might even let you deal
> with the "?subject"-type variations.

Try this, if your /bin/sh understands the ${parameter#word} and
${parameter%word} syntax (it works fine for me with bash, but is
broken with my version of /bin/ash):
--------------- snip ---------------
#! /bin/sh
#lxmutt.sh called by lynx external for mailto:'s receives
#'mailto:address@hidden' as it's argument, chops off the
#'mailto:' and subject if present, and passes the address and subject
#to an email program (here, mutt).
MAIL_PRG=mutt

#Note: URL-escaped characters in mailto-URLs are NOT handled correctly.
#
URL="$1"
RECIPIENT="${URL#mailto:}";
STRIPPED_RECIPIENT="${RECIPIENT%%[?]subject=*}"
if [ "$STRIPPED_RECIPIENT" = "$RECIPIENT" ]; then

    $MAIL_PRG "$RECIPIENT"

else    # "$STRIPPED_RECIPIENT" != "$RECIPIENT"
    SUBJECT="${RECIPIENT#*[?]subject=}"

    $MAIL_PRG -s "$SUBJECT" "$STRIPPED_RECIPIENT"

fi
--------------- snip ---------------

> And thus perhaps we might approach absolute perfection in an
> imperfect world.

Not perfection, since %XX isn't unescaped and other xxx=yyy pairs
aren't handled.

Also it doesn't handle a subject given by
<A HREF="mailto:..."; TITLE=subject>.

> PS. There are also some environmental variables set by lynx
> that might be useful, but I don't know whether/how they
> could be used with EXTERN.  The (most easily found)
> documentation only seems to mention PRINTER: and lynxcgi
> use, I think.  See:
> 
> lynx_help/keystrokes/environments.html

None of that seems to apply for EXTERN.

   Klaus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]