Recent Changes - Search:




Summary: Email obfuscation
Download: ChangeLog - WebSvn
Prerequisites: PmWiki 2.x

Status: unusable

Version: $Rev: 49 $
Maintainer: sts
Categories: !Security !Links !Spam Obsolete

Questions answered by this recipe

How do I allow [[mailto:...]] links on wiki pages

  • but mangle the links so that spammers cannot read them?
  • but they stay readable in the wiki source (mangling just during display)?
This recipe does not protect most email addresses. See Test.ProtectEmail for details.


ProtectEmail is an email obfuscation add-on for PmWiki. It rewrites mailto: links during display into some javascript code which hides the email address.

While e-protect encodes mail addresses even in the Wiki code of a page, this add-on does not. Only while displaying mails are hidden. Be aware that this might require some protection of the actions edit, diff, source and so on if you want to protect your addresses from email grabbers.


  • Copy the script protectemail.php to cookbook
  • In your config.php file, add the following line: include_once("$FarmD/cookbook/protectemail.php");


Just use [[mailto:...]] links as usual, i.e. the following markups exist:

 ## [[mailto:target]]

 ## [[mailto:target | text]]

 ## [[text -> mailto:target]]

The following version does not create a link to the email, only prints it:

 ## [[nolinkmailto:target]]

The rendered page code will look like this:

<script type='text/JavaScript'>
Nix={map:null,convert:function(a){Nix.init();var s='';for(i=0;i<a.length;i++){var  
s;},init:function(){if(!=null)return;var map=new Array();var

<script type='text/JavaScript'>
Nix.decode("<n pynff='heyyvax' uers=''></n>");

though the rendered version in the browser looks as expected:


Version in script does not match version on this pae, causing SiteAnalyzer to detect a difference

Release Notes

  • 2006-11-29 fixed [[foo ->]], thanks to Roman
  • 2006-11-13 $RecipeInfo line
  • 2006-10-31 remove whitespace before nolinkmailto addresses (thanks to Pierre Racine)

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".


  • Is it possible to provide support for mailto links which specify a subject? Eg. [[ is a subject]]. It would be quite helpful for a site I'm helping some friends with. Thanks! -- Profiles.AdamShand 2007.01.05
    • Yes, it is possible. You just have to replace spaces by %20. Then it works fine, see (the third address there). sts
      • Thanks for that, I tried it and it does work. I was thrown initially by the fact that the %20's show up in the web page but then I realized that I could make it a named link of whatever I wanted. Cheers! AdamShand
  • I would like to use Attach:... instead of the link replacement text to display an image linked to mailto:. Unfortunately, this recipe displays Attach:... as page text. SteP
  • This is great, just what I need. Two enhancement suggestions if I could please
    • many of my emails are in the format mailto:foobar&#64;example&#46;com (a previous obfuscation), would it be possible to allow html emtities?
    • some emails are in the form [[(mailto:)foobar(]], again

See Also


User notes? : 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 September 10, 2011, at 11:42 AM