Anti-Spam Email PNG


This is a simple way to display your email without fear of it getting picked up by spammers; it creates an image of the email address you send it. To be honest, I don’t think in this day and age spammers spend huge amounts of time trawling through gigs of websites looking for email addresses so all this “howard DOT yeend AT gmail DOT com” stuff I think is largely futile – have you experienced a drop in spam since obfuscating your address like that? Thought not. But hey, if you want to see how to write strings in PHP, check out the code :)

Here’s how it works, in your html source, use this simple code:
<img src=”email.php?text=(base64_encoded email address”>

email.php will generate a png of the right size, with an invisible background.

You can even customise the colour, something like this:

<img src=”email.php?r=100&g=5&b=100&text=(base64_encoded email address)”>

where ‘r’, ‘g’ and ‘b’ are the amounts (0 to 255) of red, green and blue to use.

Download PHP Source

DEMO:

Here’s my obfuscated email address:


Related Posts:

, ,

  1. #1 by speedy18us on July 31, 2009 - 10:36 pm

    Well man, you got a great blog. i can read it all day and i don’t get borred. for my future projects i will use this php code for emails. i like it.

  2. #2 by Hilton on August 27, 2009 - 2:26 am

    This is great, but people will want this to be clickable so they email directly instead of having to write it down manually as they cannot even copy/paste the text from the png.

    Is this sound possible?

    • #3 by user24 on August 30, 2009 - 11:19 am

      Yes, you’re correct. It’s not possible with this code, but there are javascript email address obfuscators that do what you’re suggesting.

  3. #4 by Sarah on September 20, 2011 - 3:29 am

    You have such an amazing blog! Thank you so much for this tip! I am excited to try it out! How long before you think the spammers catch onto us!? :)

  4. #5 by Jamey on December 12, 2011 - 3:07 am

    With regards to what hilton said about copy/paste the text from png – in all honesty, i have never in my internet life copy/pasted an email address from someones page to email them. i guess i’m even lazier than most because I won’t even bother to email someone if there isn’t some sort of contact form – so i don’t even have to leave the page.

    But hey, that’s just me and obviously many people will benefit from your email.php script. So thanks for sharing.

    And I would agree with you that, “‘howard DOT yeend AT gmail DOT com” stuff [...] is largely futile” .The main reason for my agreement is that I have my email address written normally in many places on the internet and get less than 15 spam msgs a week (or, is that a lot?).

    Anyways, congrats on your 6 years online…that’s heaps longer than most websites.

    Jamey

  5. #6 by Jerry Wright on February 10, 2012 - 9:29 pm

    Great post. I really like the point that you have made at the begining as I would not have thought of that earlier.