On 2020-04-28 00:20,
David Engel <da...@istwok.net> put forth the proposition:
> On Mon, Apr 27, 2020 at 06:28:55PM -0500, Sven Semmler wrote:
> > On Sat, Apr 25, 2020 at 09:46:48PM -0500, David Engel wrote:
> > > I've since written a filter to preprocess the HTML and remove the
> > > extra formatting before passing it to w3m.  The traditional PGP coming
> > > out of w3m is now properly formatted.  Alas, Mutt doesn't recognize it
> > > and automatically decrypt it.
> >
> > I wonder if you could just forward that sanitized block to yourself as
> > plain-text ... then mutt should deal with it just fine?
> >
> > It would add 2-3 keystrokes and be miles away from elegant ... but if it
> > works until you find a better solution...
>
> I tried that and Mutt forwards the original email in tact.  Unless
> there's another forward command that sends the decoded text (I didn't
> find ont), I don't think it will work.

I've never tried to work with encrypted messages via a script, but I
hope this is helpful or gives you some ideas.

The only thing I can think of is keep trying shell scripting a
solution that would -dump the content from stdin to text, divide the
parts, and then maybe either pipe to less to view it (not so useful
for replying) or email/forward it back to yourself using either the
mutt command line, or mail/mailx + sendmail or whichever MTA you have
handy, hopefully keeping the headers intact or add the envelope from.

Perhaps decode the encrypted part with gpg from the script, before
forwarding it to yourself.

If forwarding/emailing it to yourself doesn't work, you could print
the contents into a new file (for maildir) or append to an mbox file
(easier).  This is how I keep a custom record of sent messages from a
shell script.  It appends each message to an mbox file:

SMS="$HOME/sms/sms" # mbox file
subject=${TEXT:0:69} # this is just a substring of the message text
date=$(date +'%a %b %d %H:%M:%S %Y') # the format seems important
chars=$(printf %s "$TEXT" | wc -m)
balen=$(printf %s "$bal" | wc -m)

echo "From $FROM $date"                     >> $SMS
echo "Date: $date"                          >> $SMS
echo "To: $NAME <$TO>"                      >> $SMS
echo "From: $FROM"                          >> $SMS
echo "Subject: $subject"                    >> $SMS
echo "Status: RO"                           >> $SMS
echo "Content-Length: $((chars+balen))"     >> $SMS
echo ""                                     >> $SMS
echo "$TEXT"                                >> $SMS
echo ""                                     >> $SMS
echo "$bal"                                 >> $SMS

Each message must begin with a `From' line (without a colon).

These are the minimum headers that seem to work for me in mutt for
mbox format, but YMMV.

Calling mutt -f ~/sms/sms will read the messages, which will appear
as unread.

There should be a way to do this automatically from procmail once you
have a workable solution tested.

I hope some of this is useful anyway.

Dave

Reply via email to