Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

DeObMail

Summary: Unobtrusive e-mail link (de)obfuscator
Version: 20120717
Status: Beta
Maintainer: Petko
Discussion: DeObMail-Talk
Categories: Security Links Spam

Users: +6

License: GPL2+

Description

This recipe renders e-mail links unreadable for spambots but usable for humans.

  • E-mail links are written as usual in the Wiki source.
  • E-mail links are obfuscated in the HTML output and meaningless for spambots.
  • A small JavaScript instructs browsers how to de-obfuscate the e-mail addresses, and to display clickable links to the visitors.
  • Human users with JavaScript disabled should be able to figure out the addresses.

This recipe is now installed on pmwiki.org.

Installation

Usage

Just write your e-mail links like you usually do:

* mailto:example@example.com
* [[mailto:example@example.com]]
* [[mailto:example@example.com | e-mail me! ]]
* [[mailto:example@example.com"Tooltip title" | with a tooltip ]]
* [[mailto:example@example.com?subject=Wiki e-mail | with ?subject= ]]
* [[email me -> mailto:example@example.com ]]
  • example [snail] example [period] com
  • example [snail] example [period] com
  • e-mail me! -> mailto:example [snail] example [period] com
  • with a tooltip -> mailto:example [snail] example [period] com
  • with ?subject= -> mailto:example [snail] example [period] com?subject=Wiki%20e-mail
  • email me -> mailto:example [snail] example [period] com

Demo page.

Configuration

The e-mail addresses are converted to a special format: example@example.com becomes example [snail] example [period] com. (This format is only visible to bots and to users with JavaScript disabled.)

You can change the [snail] and the [period] parts by adding to local/config.php the following:

 $DeObMail['@'] = ' [arobase] '; # ie translated to French
 $DeObMail['.'] = ' [point] ';

Advanced admins can change the format of the HTML link snippet, by adding to local/config.php something like this:

  $DeObMail['LinkFmt'] = '<a href="%u" class="mail" target="_blank">%t</a>';

where %u will be replaced with the e-mail address, and %t with the link text.

Notes

  • Your skin needs the standard marker <!--HTMLFooter--> near the bottom of the skin.tmpl template file, right before </body></html>.
  • Emails in the wiki source are not obfuscated, so this recipe is mostly useful for wikis that have at least some password protection. Both "edit" and "source" actions should be protected.
  • Only mailto: links are protected, plain text "example@example.com" in a wiki page is not a link and will be visible.

Release notes

  • 20120717 - add $DeObMail['LinkFmt'].
  • 20111024 - minor usability improvement for readers with JavaScript disabled: when the link address is the same as the link text, it will not be repeated.
  • 20090824 - add $DeObCustom variable.
  • 20090703 - first public release.

See also

The following recipes were created with the same goal as DeObMail, but may fail to reliably protect all types of e-mail links, or may be unusable by visitors with JavaScript disabled.

Cookbook /
EProtect  Email obfuscation (obsolete)
ObfuscateEmail  Prevent email addresses from being harvested from your site (do not use, does not protect)
ProtectEmail  Email obfuscation

Contributors

This recipe is written and maintained by Petko.

Comments

Your comments are welcome at DeObMail-Talk.

User notes +6: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 25, 2014, at 06:06 PM