On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I have a contact form based on smtp/Gmail. But there is a spam-robot sending in the name Timothywaw that I want to be blocked as sender.

    Is this possible?

    I use a Gmail-account as sender/smtp host/adresse, so all emails goes through the folder Sendt in that account. But it's not possible to make filters to the Sendt folders, so I figure I have to set in the Modx Formit setup.

    Modx Revo 2.7.0
    Formit latest.

            &emailSubject=`Melding fra kontaktskjemaet på verketyoga.no`
          <form class="cmxform" id="contactForm" action="[[~[[*id]]]]" method="post">
            <input type="hidden" name="nospam:blank" value="[[+fi.nospam]]" />
      I think, thererfor I am! But what I am, and why...?
    • You can use FormIt &preHooks:

      [[!FormIt? &preHooks=`stopTheSpammers`]]

      and stopTheSpammers snippet code:

      $email = $hook->getValue('email'); // get email from a form that is actually sending
      $allFormFields = $hook->getValues();  // get all fields from that form to an array
      if (...) {
      ... // your filter code
      $errorMsg = 'Got ya spammer!';
      return false;
      } else {
      return true;

      return false stops the form and return true is continuing formit script.

      personally i would recommend some captcha systems i.e. google recaptcha.