1 (edited by gbaby76 2022-08-29 19:01:14)

Topic: Contact form not working

Hi Steven,

Sorry to keep bothering you, but I have another issue. When I first made my Showkase website I did so in a sub folder on my website so I could keep my old website active while I worked on the new Showkase website. I tested the contact form then and it worked fine. Now, I recently made my Showkase website live and moved it to the root directory and the contact form doesn't seem to be working. When I click the send button nothing happens. I recall that before there was a little message that came up saying the email was sent. I've contacted my website host and ensured that PHP mail was enabled (I read to do that in an old forum post). I've also tried deleting the original contact page and making a new one, as well as making a separate "contact2" page, but it still doesn't work. Any ideas?

Re: Contact form not working

This might be a little difficult to troubleshoot, especially as there's no error message to point us in the right direction.

I don't think the fact that the Contact Form used to work from a different folder is part of the probleem. I can't think of any reason why the Contact Form should work from one folder but not another. (Thank you for letting me know, though. The more information we have about a problem, the better.)
However, the fact that it used to work (albeit in a different location) but now does not suggests that something may have changed on your web server (round about the time you moved your Showkase site) to have caused the problem.

Try asking your web host to see if they have changed anything on your hosting account recently. Perhaps they've changed the PHP version and the new version uses different settings than the previous version.

Also, if you have access to your web server's error logs, please take a look at them. There may be an entry corresponding to each non-functional click of the 'Send' button which might give us a clue as to what is going on.

I expect you may already be using the latest version of Showkase (v1.7.6.) but, if not, please try updating as the internal version of PHPMailer was updated in Showkase v1.7.6. If necessary, instructions for Upgrading Showkase can be found here.

It's a long shot (and it shouldn't really be necessary) but you could try using the very latest version of PHPMailer (v6.6.4).
I've uploaded the file you'll need here: [Link removed.]
I've not zipped the file so when you click on the link above, you'll see the file's code. Just click the Download button near the top right of the page to download the file to your computer's hard drive.

Now, the file you'll need to replace within your Showkase site is showkase/admin/plugins/contact/master/contactcore/PHPMailer.php
Make a backup of the existing 'PHPMailer.php' file first, though (just rename it before uploading the new version), in case you need to reinstate it at a later date. (Remember this new version has not been tested by the Showkase developers.)

After replacing the 'PHPMailer.php' file, you'll need to republish your site (just click the 'Publish' button) for the new file to propagate throughout your site.

I hope this helps or at least points you in the right direction.

Re: Contact form not working

Thanks for all your help Steven! This is what I've found so far.

1. Website is running PHP 7.3.2
2. I tried using the latest PHP mailer v6.6.4 as instructed but still doesn't work
3. Error logs show this message over and over:

20220830T105704: mywebsite.com/admin/index.php
PHP Warning:  PHP Startup: Unable to load dynamic library 'ctype.so' (tried: /usr/local/lib/php-7.3.2-xenial/lib/php/extensions/no-debug-non-zts-20180731/ctype.so (/usr/local/lib/php-7.3.2-xenial/lib/php/extensions/no-debug-non-zts-20180731/ctype.so: cannot open shared object file: No such file or directory), /usr/local/lib/php-7.3.2-xenial/lib/php/extensions/no-debug-non-zts-20180731/ctype.so.so (/usr/local/lib/php-7.3.2-xenial/lib/php/extensions/no-debug-non-zts-20180731/ctype.so.so: cannot open shared ob

Re: Contact form not working

#1 That should be absolutely fine.

#2 Thanks for trying. I'm sorry it did not work.

#3 Do the times on the warnings correspond to times that the 'Send' button is clicked? (I know you won't know if visitors to your site try to use the contact form but you could try it yourself a couple of times and note the times down.)

From reading the PHP warnings, it looks to me like your PHP installation is looking for the Ctype extension but cannot find it. It's possible that your site previously used the Ctype extension without any problems but the extension may not have been carried forward after a PHP upgrade. (This is pure speculation on my part but possible, I guess.)

I don't know if this is the reason that your contact form no longer works (did your web host upgrade your PHP recently?) but it would be good to resolve these warnings. I'd contact your web host about them. They should be able to help. I expect they'll likely have seen warnings like this before so they'll probably know the cause and how to fix it.

According to a quick web search "The Ctype extension provides a set of functions that are used to verify whether the characters in a string are of the correct type.". If your PHP installation is triggering this extension after the 'Send' button is clicked but the extension cannot be found (thus returning a fail), then it's certainly plausible that this could be at the root of your problem.
I'd certainly look into getting it fixed (at least to eliminate it from the equation) before moving on to other potential causes.

I know you said that PHP Mail is enabled on your web server but it might be worth checking in with your web host to see if there are any restrictions on this service.

Here are two other things to try:

#1 You could try using SMTP to send the mail rather than PHP Mail. PHPMailer already has the code in place for this but you'll need to modify the Showkase source file which sets the values being sent to PHPMailer to include all the SMTP credentials. Instructions are in this forum post.

#2 If there is a restriction in place whereby mail is not being sent on your web server due to the email address you use not matching the domain of your website, then you could try forcing PHPMailer to not set the Sender address.

(1) Open the 'showkase/admin/plugins/contact/master/contactcore/contact.php' file in a plain text editor.

(2) Change line 88 from:

$mailer->setFrom('mailer'.strstr($siteEmail, '@'), $userName);

... to:

$mailer->setFrom('mailer'.strstr($siteEmail, '@'), $userName, false);

I don't know if this will make a difference but it is certainly a quick and easy thing to try.
Please note that the line number above refers to the current version of Showkase (v1.7.6).

Re: Contact form not working

Thanks Steven,

My web host recommended upgrading the PHP to version 7.4.1 and that stopped the error codes. The contact form still doesn't work and my web host had an "escalated support" person look at it and they said:

This is the reason the issue appears to be with the script and it needs to be fixed by correcting the script. I am afraid to say that editing the script is out of our scope. Can you please cross verify the script from your end once or by contacting a local web developer? Rest assured from the server end everything looks fine.

Anyway, I've decided to give up on the contact form and am using a simple javascript that hides my email from bots that I used on my old website and it worked well without issue. Thanks again for all your help.

Re: Contact form not working

Thank you for the update.

I can't say definitively that the script is not the cause of the issue but Showkase uses an unmodified version of PHPMailer. (The Showkase source code just passes parameters to the PHPMailer script which does all the hard work.)

PHPMailer has been around since 2001 and is still actively developed (with the latest version, v6.6.4 released 12 days ago). I can't guarantee that it's completely bug-free but Showkase v1.7.6 currently uses PHPMailer v6.3.0 and we've not had any reports (other than your own) of the contact form failing recently.

You were good enough to try the latest version of PHPMailer (v6.6.4) but without success. If this had worked, then it would point towards a bug in v6.3.0 (the version that Showkase currently uses) but this is not the case.

Also, the contact form worked in your previous Showkase site so we know the script is capable of sending mail. The script did not change when you moved your site but, for the script to fail, then logically something else must have changed (on your web server) to have caused the problem.

I'm sorry that you've not been able to get the contact form working but I'm glad that you've at least found a suitable workaround.
Thank you for letting me know.