We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33372
    • 1,611 Posts
    I actually find that using JavaScript to encode email addresses is surprisingly effective. I would’ve thought that more spambots would be on to this trick, but it still seems to work pretty well. I don’t create mailto: links however; I make my displayed email address a link to my contact form.
      "Things are not what they appear to be; nor are they otherwise." - Buddha

      "Well, gee, Buddha - that wasn't very helpful..." - ZAP

      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
      • 15806
      • 3 Posts
      Quote from: TobyL at Feb 24, 2007, 08:01 AM

      The best way of preventing spam is not to publish email addresses on your web site at all but instead point people to a contact form on your site.
      But I have never done this myself and yet I’m getting lots of spam.
      What can the problem be?
        • 30223
        • 1,010 Posts
        Quote from: g5604 at Feb 25, 2007, 04:00 AM

        Thank you grin it works perfectly. I bet a lot of people will find this very useful.

        One small tweak; Is is possible to display who you are emailing above the contact form?

        many thanks again,
        Gareth

        Sure... add another placeholder at the top of your form template: for example:
        <h1>Contact [+selected_subject+]</h1>
        


        In the snippet add another line after $templates[’tpl’] = str_replace(’[+mailaddress_tag+]’,$mail_tag,$templates[’tpl’]);
        <?php
        
           //existing line
           $templates['tpl'] = str_replace('[+mailaddress_tag+]',$mail_tag,$templates['tpl']);
           //added line  
           $templates['tpl'] = str_replace('[+selected_subject+]',$select_subjects[$email_index],$templates['tpl']);
        ?>
        


          • 30223
          • 1,010 Posts
          Quote from: KHyuga at Feb 25, 2007, 11:15 PM

          Quote from: TobyL at Feb 24, 2007, 08:01 AM

          The best way of preventing spam is not to publish email addresses on your web site at all but instead point people to a contact form on your site.
          But I have never done this myself and yet I’m getting lots of spam.
          What can the problem be?

          If you’re not publishing your email address on your website your spam problem can hardly be MODx related. As this is a MODx related support forum perhaps this is not the right place to ask this question smiley

          There are many ways in which your address can end up on spam lists, by replying to a message of dubious origin, by someone else sending you email with a lot of recipients in the To or CC field of which one address is a dubious destination, companies selling their mailing lists, etcetera etcetera,...
            • 10357
            • 573 Posts
            many thanks again Toby, your additions worked great grin
              • 33273
              • 60 Posts
              I have a problem with this....
              All I need is to get a parameter (via URL) on my contact page and to email it.

              that’s my onBeforeMailSentSnippet (for example):
              <?php
              function getBanketPlace( &$fields ){
              $placeid = (isset($_GET['place']))? $_GET['place'] : "";
              $returnstring = "";
              if (!empty($placeid)){
                $returnstring = $placeid;  
              } else {
                $returnstring = "somewhere else";
                }
              $fields['banketwhere']= $returnstring;
              return true;
              }
              return '';
              ?>


              My ContactFormReport:
              You select [+banketwhere+]!

              _______________________________________

              And it always "You select somewhere else!"
              The page uncached.
              Thanks for any help!
                • 2472
                • 151 Posts
                I used to have lots of spam in the comments of articles on my site.

                Solved the problem by adding a radio button field in the comment form, like this:
                [*] I’m a bot
                [*] I’m human
                [*] not sure...

                asking visitors to make the ’right’ choice.

                Haven’t been bothered since then... hop that bots don’t read up here smiley.
                  A thing of beauty is a joy forever ( John Keats)
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Quote from: Avander_be at May 27, 2007, 03:36 AM

                  I used to have lots of spam in the comments of articles on my site.

                  Solved the problem by adding a radio button field in the comment form, like this:
                  [*] I’m a bot
                  [*] I’m human
                  [*] not sure...

                  asking visitors to make the ’right’ choice.

                  Haven’t been bothered since then... hop that bots don’t read up here smiley.

                  Clever and simple. Good job. smiley
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me