To make it easy, I’ve code an helper function in PHP (but you could implement in your preferred language) that converts ordinary email to the RTL obfuscation pattern:
It is really simple to understand. The only “magic” is made by
strrev that changes the direction of the string.
Apply it to text paragraphs
The above function is useful if you need to write the mail alone. But what happen if the mail is inside a text paragraph? We can use the PHP
preg_replace_callback function to replace all the mails with the obfuscation code:
I’ve used a simple regular expression to match the emails, but you can use your favorite regexp (even Django one).