So, the common concern is:
If I put my email address "out there" on the web that spammers will get it and start sending me spam messages.
Well, that is a valid concern. There are scripts and crawlers which go around and look for email addresses. (And lets suppose that they also do not check for a robots.txt file.) These generally work by focusing on the syntax of the email addresses using Regular Expressions or finding the
mailto: term in the HTML code. There are some things which can be done to prevent this from happening.
- The best way is to use contact forms.
- The third best way is to use HTML characters for your email addresses.
- One way that I severely dislike is to spell out the email address or phone number like (you see a lot of this on sites like craigslist and after a few spam text messages one understands why it is done):
While this last format is human readable, it is also easy to find a regular expression which can pull these things out.
What I like to do is to add the
HTML values for symbols. This means that the symbols like the
@ sign will be translated to the browser but when they are read by the crawler that they are interpreted as a string of characters, generally messing up the regular expression. Now this is not completely fail safe, but I have been doing this on the web for 10 years and have not had a problem with spam.
Example of a link which will open up in your email client with a given subject line:
The code I use is to accomplish this is below.