Re: auto reply to html-mails

2014-01-22 Thread Chris Down
On 2014-01-23 14:48:34 +1100, Cameron Simpson wrote:
> BTW, "text/enriched"? Where does that lovely thing come from?

It was defined in RFC 1896. Almost nobody uses it.


pgpTs5PG0uWYc.pgp
Description: PGP signature


Re: auto reply to html-mails

2014-01-22 Thread Cameron Simpson
On 20Jan2014 17:08, Will Yardley  wrote:
> On Mon, Jan 20, 2014 at 03:29:14PM -0600, David Champion wrote:
> > * On 20 Jan 2014, Jan-Herbert Damm wrote: 
>  
> > > Hello all,
> > > 
> > > i would like to send an automatic answer to html-mails sent to me
> > > (because i'm tired of writing back that i prefer plain-text).
>  
> > I don't like HTML mail either (for most constructions of "HTML mail").
> > However, as tired as you are of sending it, I'm sure others are tired
> > of receiving it.  So don't send it.
> 
> Totally agree. 
> set 
> alternative_order text/plain text/enriched text/html

BTW, "text/enriched"? Where does that lovely thing come from?

My muttrc reads:

message-hook . 'unalternative_order *; alternative_order text/plain 
text/html'

# Apple Mail embeds attachments in the HTML part instead of outside the 
multipart/mixed
message-hook '~h "X-Mailer: Apple Mail" ~X 1-' 'unalternative_order *; 
alternative_order text/html multipart/mixed text/plain'

# senders who can't seem to master multipart/mixed, and send empty or 
useless text/plain sections
message-hook '%f htmlers' 'unalternative_order *; alternative_order 
text/html text/plain'

So: prefer plain text, but show (formatted via w3c automatically)
the HTML part for Apple mail because it misassembles multipart-mixed
messages, and for people in my "htmlers" group which is a list of
authors that send HTML with useless text/plain portions:

  alias -group htmlers htmlers addresses...

mailtained with a program from my address db.

Cheers,
-- 
Cameron Simpson 

..And in all of Babylonia there was wailing and gnashing of teeth, till
the prophets bade the multitudes get a grip on themselves and shape up.
- Woody Allen


Re: auto reply to html-mails

2014-01-21 Thread Bastian
On 20Jan14 17:08 -0800, Will Yardley wrote:
> set 
> alternative_order text/plain text/enriched text/html

In addition to that I also use 

  auto_view text/html

which automatically inlines html content into the pager, by using the
.mailcap routine 

  text/html; /usr/bin/w3m -I %{charset} -T text/html -dump; copiousoutput;

So, no further anoying keystrokes are needed.


Re: auto reply to html-mails

2014-01-21 Thread Jan-Herbert Damm
Hello,

thank you for your answers - special thanks to David for the detailed
considerations!

Will Yardley wrote on 20.01.14:
> On Mon, Jan 20, 2014 at 03:29:14PM -0600, David Champion wrote:
> > * On 20 Jan 2014, Jan-Herbert Damm wrote: 
> > > i would like to send an automatic answer to html-mails sent to me
> > > (because i'm tired of writing back that i prefer plain-text).
>  
> > I don't like HTML mail either (for most constructions of "HTML mail").
> > However, as tired as you are of sending it, I'm sure others are tired
> > of receiving it.  So don't send it.

It wasn't obvious to me that I seem to be motivated by a "sense of mission"
(if that's a good translation of the german "sendungsbewusstsein") trying to
prove that I am right. 
> 
> 
> configure some kind of text based browser to convert the rest (w3m or
> whatever), and get on with your life. HTML email is, these days, a battle
> that's already been lost.
Sounds like a wise (slightly buddhist) approach...

I do use w3m which works fine. But it made me angry that people force me to
do extra keystrokes.


aloha'e 

jan


Re: auto reply to html-mails

2014-01-20 Thread Will Yardley
On Mon, Jan 20, 2014 at 03:29:14PM -0600, David Champion wrote:
> * On 20 Jan 2014, Jan-Herbert Damm wrote: 
 
> > Hello all,
> > 
> > i would like to send an automatic answer to html-mails sent to me
> > (because i'm tired of writing back that i prefer plain-text).
 
> I don't like HTML mail either (for most constructions of "HTML mail").
> However, as tired as you are of sending it, I'm sure others are tired
> of receiving it.  So don't send it.

Totally agree. 
set 
alternative_order text/plain text/enriched text/html

configure some kind of text based browser to convert the rest (w3m or
whatever), and get on with your life. HTML email is, these days, a
battle that's already been lost.

w



Re: auto reply to html-mails

2014-01-20 Thread mutt
Rejo Zenger wrote:

> ++ 20/01/14 21:40 +0100 - Jan-Herbert Damm:
> >i would like to send an automatic answer to html-mails sent to me (because 
> >i'm
> >tired of writing back that i prefer plain-text).
> >
> >I am aware that this is hardly an issue of mutt, but rather procmail
> >or scripting. But i am curious how this could be approached. 
> 
> Procmail would suffice and definately for a rudimentary filter:
> 
>  :0
>  * ^Content-type: text/html
>  * ! ^X-Loop: autoreply_because_html
>  | (formail -rt \
> -A"Precedence: junk" \
> -A"X-Loop: autoreply_because_html" ; \
> cat $HOME/body_of_autoreply.txt) | $SENDMAIL -t
> 
> Or something along those lines. Untested. 
> 
> Procmail has lots of example in the procmailex manpage as well as on the 
> internet. 
> 
> -- 
> Rejo Zenger .  . 0x21DBEFD4 . 
> GPG encrypted e-mail preferred . +31.6.39642738 . @rejozenger

this recipe will also fire on emails that contain a multipart/alternative
part containing plain text and html alternatives and so would not be ideal
as mutt will hapily display the text alternative. i expect that
distinguishing such emails from ones that only contain html would take more
effort in procmail-land. better ask a procmail expert.

an alternative is to use procmail and textmail to automatically convert html
emails into plain text on their way into your inbox. the following procmail
recipe just translates html emails into plain text.

  :0 fw
  | textmail -WERPULIAVXBS

it's probably wiser for the recipe to put a copy of the original email
somewhere first.

textmail is available from http://raf.org/textmail/ and it'll need perl and
mktemp and lynx to be installed (and other things if you use its other 
features).

cheers,
raf



Re: auto reply to html-mails

2014-01-20 Thread David Champion
* On 20 Jan 2014, Jan-Herbert Damm wrote: 
> 
> Hello all,
> 
> i would like to send an automatic answer to html-mails sent to me (because i'm
> tired of writing back that i prefer plain-text).

I don't like HTML mail either (for most constructions of "HTML mail").
However, as tired as you are of sending it, I'm sure others are tired
of receiving it.  So don't send it.

If everyone autoreplied to me with the things they don't like about
my email none of us would ever get work done, and vice versa.
Philosophically: This doesn't scale, and its usefulness therefore
depends on your assurance that you're better than other people and that
they need your help to improve.

http://en.wikipedia.org/wiki/Robustness_principle

That said, here's what you need to think about to actually do this.
It's well beyond a matter of mutt vs. procmail, and needs some serious
thought about how email works, so I think it's actually somewhat in
scope for this list.


> My setup for receiving mail is: fetchmail --> procmail --> spamassasin --> 
> mutt 
> 
> and for sending: mutt --> msmtp --> ...
> 
> A hint on how to proceed will help me.

Any effort at this needs to be very precise, because an exact
determination of whether you're receiving "HTML mail" is not
script-simple.  Not all mail containing HTML is either "HTML mail" or,
really, badly done.  If you do it wrong, you'll be sending autoreplies
to people to complain about something that they might well be doing
correctly.

If you're going to auto-reply, you don't really need to worry about the
presence of HTML.  Your real goal should be to detect reliably whether
the incoming message has a meaningful text part that your mail reader
will see and use, or has incorrect alternative encodings.

Things to be aware of/things that could go wrong:

A message might have no MIME whatsoever -- that is, it might be
implicitly and nominally plain text -- but it might still contain HTML.
Do you choose to detect and respond to this?  What if someone is writing
plain text email about HTML?

For MIME messages, you will need at least to extract each content-type
header in each MIME part of the mail.  You can perhaps make 95% reliable
generalizations about a flat, linear list of content types that you
find.  For example:

* if you see only text/html MIME parts, then the mail is most probably
HTML (but see above; some nominally HTML mail in fact contains only
plain text).

* if you see multipart parts with only html text contents, likewise.

* if you see multipart containers with a mix of plain and html contents,
you should be cautious.  The order of parts probably tells you whether
the html or the plain is primary (first), but this could be misleading.
For 100% certainty you need a full-depth parse tree such as you'd get
with python's mime message parser, so that you know for sure which text
parts belong to which container.

A message containing both HTML and plain text parts might or might not
be "HTML mail".  Multipart/alternative is the preferred MIME structure
for expressing alternative views of identical content.  It's good for
sending mail that is HTML for those who can and wish to see HTML, while
sending plain to others.  A multipart/alternative message contains two
or more sub-parts of different content-types.  The user agent should be
able to select whichever format its user prefers.  If the user/agent
does not express preference, the first part should be used.  The first
part should be the simplest available encoding -- that is, in most
cases, plain text.  This ensures that the default view is the most
available/accessible one.

So there are two ways that a multipart/alternative commonly fails:

1. they often (usually?) put the HTML part first, because that's how the
sender would prefer for you to see the mail.  This disrespects the rule
that it should be the most accessible -- it favors the sender over the
receiver.

2. they sometimes put in a plain part, and put it first, but its
only content is to tell you that you should use an HTML-capable mail
application.  This breaks for onyone who expresses preference to text in
their application settings.

In light of #2, you also would ideally have some statistical heuristic
that tells whether the "plaintext" version is obviously not a
translation of the HTML version into plain text.  If the HTML is 98K and
the text is one line, it's probably not the same content.  If the HTML
is 12 lines and the text is two, who knows?  You may need to look at the
co-incidence of individual words to avoid making errors in automated
analysis.

It's non-trivial, and probably not worthwhile as a one-off procmail
recipe.  As a standalone program that vets the plaintext compatibility
of a MIME or non-MIME message, which can be incorporated into a procmail
rule, it would be nice to have on several fronts.

Beyond this you should also be cognizant of the obligations of any
autoreply mechanism to detect and prevent mail loops.  Most of my HTML
mail comes from automat

Re: auto reply to html-mails

2014-01-20 Thread Rejo Zenger
++ 20/01/14 21:40 +0100 - Jan-Herbert Damm:
>i would like to send an automatic answer to html-mails sent to me (because i'm
>tired of writing back that i prefer plain-text).
>
>I am aware that this is hardly an issue of mutt, but rather procmail
>or scripting. But i am curious how this could be approached. 

Procmail would suffice and definately for a rudimentary filter:

 :0
 * ^Content-type: text/html
 * ! ^X-Loop: autoreply_because_html
 | (formail -rt \
-A"Precedence: junk" \
-A"X-Loop: autoreply_because_html" ; \
cat $HOME/body_of_autoreply.txt) | $SENDMAIL -t

Or something along those lines. Untested. 

Procmail has lots of example in the procmailex manpage as well as on the 
internet. 

-- 
Rejo Zenger .  . 0x21DBEFD4 . 
GPG encrypted e-mail preferred . +31.6.39642738 . @rejozenger


pgpsJs4E3Pe5M.pgp
Description: PGP signature


Re: auto reply to html-mails

2014-01-20 Thread Patrick Shanahan
* Jan-Herbert Damm  [01-20-14 15:43]:
> i would like to send an automatic answer to html-mails sent to me
> (because i'm tired of writing back that i prefer plain-text).
> 
> I am aware that this is hardly an issue of mutt, but rather procmail or
> scripting.  But i am curious how this could be approached.

best would be to ask on the procmail list:

List-Post: 
List-Subscribe: ,

List-Unsubscribe: ,

List-Archive: 
List-Help: 
List-Id: discussion of the procmail program 

-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
http://wahoo.no-ip.orgPhoto Album: http://wahoo.no-ip.org/gallery2
Registered Linux User #207535@ http://linuxcounter.net


auto reply to html-mails

2014-01-20 Thread Jan-Herbert Damm

Hello all,

i would like to send an automatic answer to html-mails sent to me (because i'm
tired of writing back that i prefer plain-text).

I am aware that this is hardly an issue of mutt, but rather procmail
or scripting. But i am curious how this could be approached. 

A goolgle-search brought up one thread concerning auto reply for
vacation but that seems not really what i'm looking for.

My setup for receiving mail is: fetchmail --> procmail --> spamassasin --> mutt 

and for sending: mutt --> msmtp --> ...

A hint on how to proceed will help me.

thanks

jan