We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17971
    • 17 Posts
    In a bit of serendipity, I found that our SPForm contact form had stopped working. Because it had been working so reliably, we hadn't tested it for a long time, so I'm not sure when it stopped working, but I believe the problem is related to the recent upgrade to MODX Revo 2.4.1.

    As long as I'm logged in to the Manager, it works perfectly, both with its default properties and with the custom property sheet that turns on Captcha with the math problem and allows the reset button to appear. However, when I log out and test it, it fails with this error message:

    "Unauthorized Access in spformproc"

    I have already tried uninstalling, completely removing, and reinstalling SPForm from a fresh download.

    I have tested the mailing function (using SMTP -- same as SPForm) with QuickEmail, and it works flawlessly.

    I have tried setting the &warnAll, &spfDebug, and &adviseAll settings to 1, but AFAICT, everything looked normal.

    Bob, what else do I need to do to get this fixed? Could it be caused by corruption in the MySQL db (which turned out to be the cause of an inability to update plugins following the 2.4.1 upgrade), and if so, where in the db should I look?

    Thanks in advance.
      • 3749
      • 24,544 Posts
      As far as I can tell, only two things would cause that.

      1. The emailsender System Setting is empty or less than 5 characters long.

      2. There's a problem with $_SESSIONS causing the $_SESSION['include_auth'] variable to be missing or incorrect.

      Let's hope it's the first one. wink

      If you don't have one of the two sections in .htaccess that force www or non-www URLs uncommented, that could cause the $_SESSION problem.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 17971
        • 17 Posts
        Well -- it's not 1. emailsender is set to a known working email address over 5 characters.

        Checking on 2.
          • 17971
          • 17 Posts
          OK, with the help of the chief technician at our outstanding hosting company, lexiconn.com, we've got it solved. He suggested that it was a DMARC problem https://en.wikipedia.org/wiki/DMARC -- and it appears that he was correct.

          While I don't understand the mechanism that made it happen, for some reason, giving MODX an email address to which to send errors or system emails which is not on the website's domain caused this error message to appear whenever the contact form was tested from that same address. The workaround, then, is to supply MODX only with addresses hosted on the site's domain, then forward messages from those addresses to the desired destination.

          In this case, I replaced my own email address with [email protected] in the System Settings (quip.emailsTo) and in the SPForm custom property set (errorsTo). I have also set up the [email protected] account to forward to my email address. Now, the contact form works perfectly every time I test it.

            • 3749
            • 24,544 Posts
            I'm glad you got it sorted. Thanks for reporting the fix. smiley
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 36426
              • 197 Posts
              Hi sorry to bother.

              Is there a way to just add one extra field to an spform? I have a couple of sites just needing a "Phone Number" box - it seems a fair bit of extra trouble setting up FormIt... SpForm works great and is lovely and simple so I'd rather stick with it if there is any way to just have an extra field?

              Thanks for any help.
                Yorkshire UK based hosting provider: https://www.simulant.uk
                • 3749
                • 24,544 Posts
                SPForm was designed to be a quick and easy contact form. I assumed that only people who were not up to using FormIt would be using it. I should have made it easier to add fields when I refactored it for Revolution (long, long ago when I was fairly new to MODX and PHP). The code is, frankly, embarrassing. SPForm doesn't even use a Tpl chunk for the message.

                The only option would be to add an input named 'phone' (name="phone") to the spform TPl chunk and add a line of code to the core\components\spform\model\spform\spformprocclass.inc.php file to put it in the message. It would go just after line 379. Just above this line:

                 $this->_content .= preg_replace('/\r/', '', stripslashes($_POST['comments']));


                The code would be something like this:

                $this->_content .= '<br />Phone: ' . stripslashes($_POST['phone']) . '<br />';


                I'm sorry it isn't easier. sad


                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 42141
                  • 73 Posts
                  Out of the blue it stopped working on my site sad

                  After submitting the form I get the following error: A not allowed server tried to get access to this form
                    • 3749
                    • 24,544 Posts
                    Check the &formProcAllowedReferers property of the snippet tag. Make sure it includes your server (yoursite.com,www.yoursite.com).

                    Also, check the emailsender System Setting and make sure it's an address at your own server.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 42141
                      • 73 Posts
                      Yeah, that were indeed the culprits smiley Everything is working fine now! I did first test with QuickEmail however, to be sure it wasn't my host. Big thank you for your snippets and guides smiley!