Formit no longer redirecting to thankyou page

Hi All,

I’ve just moved a site to a new server and formit is no longer redirecting to the thankyou page, it just reloads the page but does save the form in formsave:

the call I am using is:

[[!FormIt?
                   &hooks=`spam,FormSave,email,redirect`
                   &emailTpl=`MyconsultationChunk`
                   &emailFrom=`[[+email]]`
                   &emailTo=`emai@email.com, email2@temail2.com`
                   &redirectTo=`112`
                   &fsFormTopic=`Consultation`
                   &emailSubject=`Consultation form completed`
                   &validate=`name:required,
                      email:email:required,
                      phone:required`
                ]]

Does anyone know why this would stop working when I’ve simply moved to a new server ( have done 100 + moves with no issues.

Errors in the manager log:

[2022-03-17 16:19:55] (ERROR in xPDO::getService @ /home/customer/www/domain.com/public_html/core/xpdo/xpdo.class.php : 1235) modRestClient::__construct is deprecated since version 2.3.0. Use the modRest classes instead.
[2022-03-17 16:19:55] (ERROR in modRestCurlClient::__construct @ /home/customer/www/domain.com/public_html/core/model/modx/rest/modrestcurlclient.class.php : 26) modRestClient::__construct is deprecated since version 2.3.0. Use the modRest classes instead.
[2022-03-17 16:19:55] (ERROR @ /home/customer/www/domain.com/public_html/core/components/formit/src/FormIt/Hook/Email.php : 322) [FormIt] An error occurred while trying to send the email. Could not instantiate mail function.

Site is up to date, all extras are up to date and I’ve tried every php version from 7.3.33 up to 8.1.3

Any advice would be great ( all forms on the site have stoped redirecting ).

Thanks

The form doesn’t redirect because the email hook fails.

An error occurred while trying to send the email. Could not instantiate mail function.

If 1 hook fails, the next hooks in the list don’t get executed.


From Bob's Guides | QuickEmail Snippet

If you see a message that says, “Could not instantiate mail function,” it usually means that either your host has the mail() function turned off (many do) or that you are using a localhost install and there is no working mail server. In that case, one option is to use the MODX SMTP Systems Settings so that MODX will send the mail from an SMTP server (e.g., Gmail) where you have an account.

1 Like

Thanks for replying Harry,

Unfortunately I can’t install Bob’s Quick Email as there is no download link in the extras and If I try to upload it from my desktop it just says “Unknown”

I have however resolved it by changing the below to a email address from the domain:

&emailFrom=`[[+email]]`

to &emailFrom=`a-domain-email-address.com`

You can download QuickEmail here by clicking on the version number.

You can also install it in Package Manager. Just click on Download Packages and put QuickEmail (one word) in the search box.

Hi Bob,

I don’t get the “Download” button through the extras section as stated earlier, if I download it and try to upload the .zip file I just get an “Unknown” error

Just to say on this, running the latest PHP version and the latest MODX, all extras are up to date.

That’s crazy. Normally, that would only happen if your MODX version was < 2.0.

Is there anything relevant in the MODX error log?
Does the console show any JS errors in Dev Mode?

I’d suggest manually deleting all files in the core/cache directory, repairing all DB tables, and re-running setup (extracted from the exact same MODX version you’re running).

The “rest” errors can be ignored. I get them too.

Are you sure it’s not already downloaded?

There was nothing in the error log or console and was not already installed, funny thing is that I’ve just tried this on my laptop and the download button shows :thinking: , if I go back up to the office it doesn’t show, both running the same operating system and both using the latest version of chrome.

Clearing the cache with the CacheClear extra and trying incognito or private mode in the browser will rule out cache issues. I also install the Cache Killer Chrome add-on and turn it on when stuff like this happens.

It can also help to watch the Network tab (Ctrl-shift-i) as you run your program.