I really like good text formatting. (Man pages get me all a-tingley.) Thus, I like my email to be formatted nicely when I reply to people. The solution: email_tremendufy!
I created a simple framework for filtering mail using Mail::Filter, Mail::Internet and a few source filtering tricks. Thus, I now immediately pipe my replies through a script that looks like this:
use HairyMailFilter;
# remove RT header stuff
filter {
s/>.*\n> -{72,}\n/\n/s;
};
# trim signature
filter {
s/(?<=\n)> -{2,4} ?\n(>.+?\n)+/\n/gs;
};
# remove greetings
filter {
my $greetings = join('|',qw(
hi hello hey howdy morning ));
...
..and so on. Thus my replies are pretty. Download the email_tremendufy script and the HairyMailFilter module.
Here's my vim keybinding that pipes my reply through the script and inserts a new line before all the quoted stuff:
map \r <Esc>:%! email_tremendufy <CR>/^$<CR>o<Esc>O
Unfortunately, this essentially applies a series of regular expressions on a chunk of text. Here's what I'm thinking of for a better approach:
use LessHairyMailFilter;
# remove RT header stuff
message->quoted->trim_until( qr/^-{72,}$/m );
# strip signature after a "--" line
message->quoted->trim_after( qr(\n--\s*\n.*$/s );
# change email addresses to name using getpwnam()
# but only if on "On date x, so-and-so wrote:" lines
# (line-by-line basis)
message->filter_lines( qr/wrote:$/ => \&email_to_names );
# autoformat using Text::Autoformat
message->quoted->autoformat( right => 70 );
# remove duplicate lines
message->filter( sub { s/\n\n\n/\n\n/gs while/\n\n\n/ } );
...where the quoted method would represent the large "> text\n> more text\n" blocks, without the ">" quoting. Anyway, that's another project.... it works for now.
On another note, I found a simple way to make sure that my browsing is secure while I'm on wireless at my apartment and let me browse advertisement-free. Use Privoxy (there's a Mac OS X package that installs in seconds and provides a startup item) and edit the config (/Library/Privoxy/config) and add the following line in the SOCKS proxy section:
forward-socks4 / 127.0.0.1:1080
.
I then start the tunnel to my desktop with ssh -D 1080 user@my.desktop and then tell the browsers to use 127.0.0.1:8118 as the HTTP and HTTPS proxy (System Preferences -> Networks -> Proxies). Whabam -- secure web browser.
Now, if only DNS lookups were secure. Then nobody would sniff all the porn.
my email is pretty, my wireless web browsing is secure 0 Comments More | Login | Reply /