CalderaWP / Caldera-Forms

Drag and drop, responsive WordPress form builder.
https://CalderaForms.com
GNU General Public License v2.0
187 stars 166 forks source link

Caldera Forms always returns success, even if wp_mail fails. #2465

Open Gabweb opened 6 years ago

Gabweb commented 6 years ago

Versions:

WordPress Version: 4.8.6PHP Version: 7.1.7MySQL Version: 5.7.19Caldera Forms Version: 1.6.1

Does Your Issue Persist When You Disable All Other Plugins and Switch To The Default Theme?

Tested with a clean WP installation + only Caldera Forms installed.

Expected behavior:

Caldera Forms should return an error message if wp_mail returns false.

Observed behavior:

Caldera Forms always returns success. (With and without ajax)

Steps to recreate the issue:

Break the wp_mail on purpose: e.g. by using the following plugin: https://gist.github.com/Gabweb/f15d789017647ac302e744977c500780#file-break-wp-mail-php

Alternative: Replace all wp_mail(...) calls with false.

Shelob9 commented 6 years ago

This makes sense to change. What would you want to happen if it returns false?

Gabweb commented 6 years ago

Anything else than a success message! I think a simple error message to the user would be great. For example, "Your message could not be deleviered. Try again or contact the page adimistrator."

As addition, but not necessary: The possibility to change the error message in the form settings.

Shelob9 commented 6 years ago

@Gabweb That makes sense. I'm going to think about how best to do this over the weekend.

Contact Form 7 works basically like that. I don't love it as someone filling out the form. Makes me wonder how to contact admin/ why it's my problem as site visitor/ etc. But it's useful.

I wonder if it's better to only show this in the preview mode or if current user is an admin?

black-eye commented 5 years ago

+1

ictbeheer commented 5 years ago

This would especially convenient if submissions are not stored. In that case a wp_mail error leads to a lost submission. As for the message, instead of 'the page administrator' maybe use the 'admin_email' option?

jfrancais commented 4 years ago

yes, I need this fix. Recently an issue with newest PHP and Cloudlinux broke the wp_mail function. It was returning false. Unfortunately I didn't know about it for a long time, until a client told me they hadn't received email from their system in quite some time. There absolutely needs to be some reporting or error return that the wp_mail failed to send the email.