WPMUDEV Contact Form Problem 'There was an error sending the email'

Dear WPMUDEV/Forum

Please can you help me with a problem I am having with the Contact Form on my site.
It is the WPMUDEV contact form widget that I am sure I have set up correctly but whenever someone tries to use it they get the following error: "There was an error sending the email".
I've managed to get it working in the past but it would send the person's email as MY email so I wouldn't have a way to get back to them. I trawled through the many WPMDEV support pages and tried removing and reinstalling, checking smtp settings with domain host, etc. I managed to get it to work once but only once, and now it does not work at all.

Can anyone help with this?

Thanks! :smiley:

  • Tom

    Hi Predrag and THANKS for replying.

    The contact form plugin has never worked for me.

    Changes to installation
    To fix it I installed Easy Wp SMTP and it tested fine. But that was causing the contact form submits to come through as if sent from my own email address, which I didn't realise as I was testing it with my own email address. Foolishness.
    I have since deleted Easy WP SMTP and the contact form plugin worked literally once. But then as I saved and exited and checked on an external PC it came up with 'There was an error sending the email' and that's all I've been getting since. Sadness.

    Changed admin email
    I've never changed the admin email, although I did have the 'mail to' address as one different to my WP admin email. I have since changed the mail to address of the contact form to be the same as my WP admin email but still no luck. Sadness.

    Can you offer any further assistance please?

    Thanks for trying so far!

  • Predrag Dubajic

    Hi Tom,

    Thanks for the additional info about the SMTP, based on your original question I thought that you had it working one time and it stopped working after that, this does clear things up a bit.

    Would you mind allowing support access so we can have a closer look at this?
    To enable support access you can follow this guide here:
    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Best regards,
    Predrag

  • Predrag Dubajic

    Hi Tom,

    I just noticed that you are not actually using Contact Widget plugin the footer, you are actually using Upfront contact element in there.

    500 error that is showing in console is most likely caused by server configuration or something else blocking your emails.

    I would suggest deactivating your other plugins and see if there's any improvement after that, and it would also be a good idea to contact your hosting provider to see if there's anything server side that is blocking your emails from going through.

    Let us know if that gives any results.

    Best regards,
    Predrag

  • Adam Czajczyk

    Hello Tom,

    Thanks for your replay!

    I took a liberty of accessing your site and running some more tests. I could see the "500 internal server error" in browsers console and I think this is quite relevant here.

    The console reports that error in relation to XHR call to WP Ajax. This is usually because of violation of Same Origin Policy but in fact can be caused by many different reasons starting from file/folder permssions (some servers do apply very strict limits here), ending with CURL issues.

    That said, I'd like to ask you to run WP debug. To do this, please add following lines to your site's "wp-config.php" file right above the "/*That's all, stop editing...." line:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    This will turn on WordPress debugging and redirect its output to a "debug.log" file inside "/wp-content/" directory on your server. Once these lines are in place, please try using contact form (or better both) on your "Contact US" page (being logged-out from you site) and then share the content of "/wp-content/debug.log" file with me, please.

    Best regards,
    Adam

  • Tom

    Hi Adam!

    I hope you are well and thanks for your kind assistance.

    I have tried following your instructions and once I put the debug true lines in place and tried the form it still gave me the error message on my site. BUT when I went back in to the server via ftp I could not see the debug.log file in the wp-content folder. Is it just a matter of waiting? I left it for approx 10 minutes.

    Please see the attached image for what I added and then for what files were in the wp-content folder (no debug.log).

    If I have incorrectly followed your advice then please let me know. Thanks for your help so far!

    Kind regards
    Tom

  • Adam Czajczyk

    Hey Tom,

    Thanks for your response!

    Lack of "debug.log" file may mean one of two things: either WP didn't find any errors ("worth debugging") or it wasn't able to write to the file due to the folder permissions. Let's however try simpler way:

    please change

    define( 'WP_DEBUG_DISPLAY', true );

    to

    define( 'WP_DEBUG_DISPLAY', true );

    This should work pretty much the same but instead throw all errors directly into the site so you should be able to see them instantly. If you could then try sending those forms it would be great. If any additional (except the one we already know from form itself) errors come up, please copy and paste them here.

    After testing you may want to change the line back to "false" so no more errors would be shown on screen (as they are publicly visible to the visitors of the site).

    I hope this way we'll be able to get some steps closer to the solution.

    Best regards,
    Adam

  • Tom

    Hi Adam

    Thanks again for your help - really appreciated - but I did as you requested above (changing it from false to true, as I assume you meant) and there were no errors displayed anywhere on the site. I tried in a few browsers and on a different network - nada.

    Once I'd stopped crying I decided to change the debug back to false in the config file and put it down to a battle lost. I think all I can do is find an alternative method of gathering contact info and messages, addresses etc. Suggestions welcome.

    It is strange because I also had a successful completion of the form received yesterday evening. So a member of the public was able to use it but I couldn't replicate that success myself.

    Baffling. Frustrating. Sadness.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.