Today a friend pointed me to an old Blog-Post that talks about obfuscating mail-addresses.
Cool stuff I thought at once.
Especially simply using the code-direction to obfuscate the mail caught my eye.
But on the second glance, there was one major drawback. Try to bring such an eMail-address to your mail-client by copy and pasting. The nice and shiny address foo@example.com suddenly transforms into an ugly moc.elpmaxe@oof.
But hey, the user wants to click onto the mail-address anyway. So no Problem there. Simply add a mailto-Link to the obfuscated eMail-address and thats it.
Oh, wait! Major drawback there.
- Either I have to use the plaintext eMail-Address – Why go through the hassle of obfuscating the address in the first place?
- Or I need some way of translating the reversed address into a plain one without someone noticing.
So I fiddled around a bit and came up with a simple server-side script that not only allows you to use obfuscated mail-addresses, but also gives you the possibility to add some informations to the mail, the user is about to write.
PHP to the rescue. Assume that the link looks like that
<a style="unicode-bidi:bidi-override; direction: rtl;" href="redirect.php?mail=moc.elpmaxe@oof"> moc.elpmaxe@oof </a>
Then you simply need a server side script that look something allong these lines (here an example in PHP)
<?php header('Location: mailto:' . strrev($_REQUEST['mail']) . '?subject=my%20Subject');
Thats all!
Nothing more!!
Simply reverse the string and send a Location-Header that instantly redirects the browser to a mailto-URI. That causes the browser to fire up the users default mail-client, create a new Mail, address it to foo@example.com and also set the subject to “my Subject”.
Update
There is a module for ZendFramework2 for that at https://github.com/heiglandreas/OrgHeiglMailproxy
Hey, Andreas!
Einfach aber gut. Danke für den Tipp 🙂
Schöne Grüße aus der Hauptstadt
Stefan