Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


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

Fix for Outlook quoting (was Re: AARRRRGH!!! (was RE: Linux Install error)



Jeff Kinz writes:

> GOOD NEWS- There is a fix for Outlook that sets Outlook up to respond
> to emails in the normally accepted fashion:

Of course, these solutions depend on the benevolence of the people who
actually use these mailers.

OTOH, a while ago I wrote a quick hack that I use to transform
Outlook's broken quoting style into something reasonable.  This is
attached.  I use this program when I have to jump into a thread [1]
that is already being conducted using this broken quoting style.  I
hope that other people find it to be useful as well.

Regards,

--kevin

[1]  Most versions of Outlook don't seem to handle threading either,
     which in a twisted sort of way, seems to justify this broken
     quoting style.

-- 
Kevin D. Clark / Cetacean Networks / Portsmouth, N.H. (USA)
cetaceannetworks.com!kclark (GnuPG ID: B280F24E)
alumni.unh.edu!kdc




#!/usr/bin/perl

# fix-outlook-quoting.pl

# Author:  Kevin D. Clark (alumni.unh.edu!kdc)


# This program will take a region of text that looks like this....:

# > Kevin ,
# >
# > Blah blah blah blah blah bla.
# >
# > Ralph
# > 
# > 		 -----Original Message-----
# > 		From: 	Clark, Kevin
# > 		Sent:	Thursday, January 03, 2002 8:18 AM
# > 		To:	A bunch of people
# > 		Cc:	A bunch of other people
# > 		Subject: life, the universe, and everything
# > 
# > 		Ralph,
# > 
# >     Mumble mumble mumble mumble.
# > 
# > 		Kevin

# (you'd end up with such a region of text if your mail program quoted 
#  email in the cannonical way, and you had to deal with brain-dead
#  email clients like Outlook)

# ....and transforms this into this:

# > Clark, Kevin writes:
# > > Ralph,
# > > 
# > > Mumble mumble mumble mumble.
# > > 
# > > Kevin
# 
# > Kevin ,
# >
# > Blah blah blah blah blah bla.
# >
# > Ralph
# > 
# `


# this program is also general enough to handle a whole thread of the 
# braindead outlook quoting style.  After this transmogification is performed,
# it's simple enough to edit the resulting text to actually look decent.


# If you use emacs as your editor and you've yanked the mangled message into
# your reply buffer, some variant of:
#
#   C-u M-| fix-outlook-quoting.pl
#
# will suffice.

# If you use vi as your editor, some variant of:
#
# ma  (move to end of mangled text)
# :'a,.!fix-outlook-quoting.pl
#
# might work.



# Version history:
#
# 0.1 - initial version
# 0.2 - renamed original identifiers to be less offensive


undef $/;

$_ = <>;

($firstPart, $screwed) = /(.*?)(>\s*---*Original Message---*.*)/s;

# print ":$firstPart:\n";

$screwed =~ s/^[> \t]*//mg;

@screwedList = split(/---*Original Message---*/, $screwed);

# the first item in the list is screwed, er, I mean, blank...
shift @screwedList;


$i = 1;
for $f (@screwedList) {

  ($from) = $f =~ /From:\s+(.*?)\s*$/m;

  print "> " x $i++;
  print "$from writes:\n";
}

$i = scalar(@screwedList) + 1;
for $f (reverse(@screwedList)) {

  # delete first "paragraph" of screwed "headers"
  $f =~ s/.*?\n\s*\n//s;

  # quote properly
  $quotes = "> " x $i--;

  $f =~ s/^/${quotes}/mg;

  print "$f\n";
}

print "$firstPart\n";






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org