Obfuscating Email Addresses in Form Fields

I’m writing a WP Theme where registered users can email post authors sending them en email from the post’s page itself.

So I created a contact form in which I get the user and author infos and emails and I put them in hidden input fields to pass them to the php mail function.

Does WordPress have a way to obfuscate the post author’s email address, to protect it from scrapers? Is there a better way to implement this functionality, other than outputting the author email address in the form field?

Thanks!

2 Answers
2

Core function to obfuscate mail addresses:

antispambot( $emailaddy, $mailto );

Second arg is 0 or 1 and optional.

Leave a Comment