Fixing Obfuscated Emails in Gmail with Dotjs

– 285 words

Even though moderm email spam filters have become sufficiently good at protecting our inboxes, people (including myself) still feel the need to obfuscate their email addresses when listing them on public websites so spam scrapers don't get their address. Seems reasonable.

However, when I want to email someone who has done such obfuscation, I need to copy their address, paste it into Gmail and then manually correct the obfuscated parts so that Gmail will recognize the email format.

This became tiresome. I wondered why Gmail couldn't be smart enough to recognize some of the common patterns and just auto-correct it automatically.

Then the thought occurred to me: maybe I could write a custom dotjs file to do this for me. If you don't know about dotjs files, you should check it out at Basically it is a Chrome extension that acts as a better version of Greasemonkey scripts that can customize any webpage.

The script itself is pretty simple:

$(document).ready(function() {

  // automatically fix obfuscated email addresses pasted into
  // to/cc/bcc fields                                                                                                                                                              

  $("textarea[name=to], textarea[name=cc], textarea[name=bcc]")
  .live('blur', function(e){
    var text = $(this).val();
    text = text.replace(" at ", "@");
    text = text.replace("_at_", "@");
    text = text.replace("[at]", "@");
    text = text.replace(" dot ", ".");
    text = text.replace("_dot_", ".");
    text = text.replace("[dot]", ".");
    text = text.replace(" daught ", ".");
    text = text.replace("_daught_", ".");
    text = text.replace("[daught]", ".");

It can also be found in my .js repo on github:

When you paste in an obfuscated address, the script will automatically look for common patterns and replace them with the appropriate characters when you tab or click to the next field. So, pasting in emails like this:

...become this:

Piece of cake!

Further discussion on Hacker News.

— Fin.
Tagged: email gmail dotjs

Like this post? Please share the love!
blog comments powered by Disqus