SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Clickable mailto link on site and spam

  1. #1
    SitePoint Enthusiast Albablue89's Avatar
    Join Date
    Jul 2005
    Location
    Scotland
    Posts
    98
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Clickable mailto link on site and spam

    I've went and intergrated a secure PHP / Javascript contact form on a website, to be told be the owner after finishing the website that she wants her email address listed as well as the contact form.

    Now, I guess I have options here to either go with the flow, do what she wants in the best way I can, or I try to explain the contact form is for a legit reason.

    Now I've just have a read at http://www.sitepoint.com/spamproof-site/ And I'm thinking of just using the following JavaScript to create a mailto link that displays the actual address.

    Code:
        <script language=javascript>  <br>  
          <br>  
        <!--  <br>  
        var username = "username";  <br>  
        var hostname = "yourdomain.com";  <br>  
        var linktext = username + "@" + hostname;  <br>  
        document.write("<a href=" + "mail" + "to:" + username +  <br>  
        "@" + hostname + ">" + linktext + "</a>")  <br>  
        //-->  <br>  
        </script>
    Is this advised or what?

    Thanks.

  2. #2
    Mouse catcher silver trophy
    SitePoint Award Recipient Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,205
    Mentioned
    67 Post(s)
    Tagged
    1 Thread(s)
    While the contact form may be there for a legitimate reason (ie preventing spam), that doesn't mean that it's the most user-friendly method. I would generally recommend providing the option to use either a contact form (allows people to choose the email address they want you to reply to) or an email link (people often have more confidence in an email than a contact form, it means they have a record for themselves of what they sent, and you don't have to worry about eejits who mistype their own email address (and yes, a lot do!)).

    I certainly would not recommend obfuscating the email address with Javascript, although if you're allowing people to use a script-free contact form then it isn't a cardinal sin, just a slightly bad one.

    An easier way, which I have had reasonable success with, is to simply replace the @ with &#064; (in both the link text and the mailto address) – it comes out as the same, the link still works the same, but it does seem to be reasonably effective at disguising it from spambots. (I would still suggest putting a different email address there, which you can discard if it does start to pick up intolerable amounts of spam).

  3. #3
    Life is not a malfunction gold trophysilver trophybronze trophy
    SitePoint Award Recipient TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    3,828
    Mentioned
    134 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by Stevie D View Post

    An easier way, which I have had reasonable success with, is to simply replace the @ with @ (in both the link text and the mailto address) – it comes out as the same, the link still works the same, but it does seem to be reasonably effective at disguising it from spambots. (I would still suggest putting a different email address there, which you can discard if it does start to pick up intolerable amounts of spam).
    I use a similar approach, and run the e-mail address through this encoder. It seems to work pretty well at stopping spam, although I also do as Stevie D suggests and use a disposable e-mail address, just in case. (So far, I've not needed to change one. )

  4. #4
    SitePoint Enthusiast Albablue89's Avatar
    Join Date
    Jul 2005
    Location
    Scotland
    Posts
    98
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    An easier way, which I have had reasonable success with, is to simply replace the @ with @ (in both the link text and the mailto address) – it comes out as the same, the link still works the same, but it does seem to be reasonably effective at disguising it from spambots. (I would still suggest putting a different email address there, which you can discard if it does start to pick up intolerable amounts of spam).
    Quote Originally Posted by TechnoBear View Post
    I use a similar approach, and run the e-mail address through this encoder. It seems to work pretty well at stopping spam, although I also do as Stevie D suggests and use a disposable e-mail address, just in case. (So far, I've not needed to change one. )
    Nice... Very niffty indeeed and fair points made.

    I actually seen your @ trick in another thread, shortly after posting this thread. I think it's a good call, and I also like the look of the encoder to add some extra spice to it all. So, I'll go with using ascii characters and symbols on a different email address that I can alias as I normally would.

    Cheers, Chuggers!

  5. #5
    Life is not a malfunction gold trophysilver trophybronze trophy
    SitePoint Award Recipient TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    3,828
    Mentioned
    134 Post(s)
    Tagged
    5 Thread(s)
    Off Topic:

    Quote Originally Posted by Albablue89 View Post
    Cheers, Chuggers!
    Another Chuggington fan? I knew you were one of the good guys.

  6. #6
    SitePoint Enthusiast Albablue89's Avatar
    Join Date
    Jul 2005
    Location
    Scotland
    Posts
    98
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Quote Originally Posted by TechnoBear View Post
    Another Chuggington fan? I knew you were one of the good guys.
    Haha!!! Nothing like a bit of Story Time

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •