[Resolved] Don't get notification when submitting post form
This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
When editing a post form I have set an email notification when submitting the form send notification to a WordPress user: landman.re. Although at hello@landman.re I don't get the notification when submitting the form.
That will record a log of all sent emails, so it will identify if there is a problem with sending an email vs receiving an email (e.g. marked as spam).
Can you test again with that plugin active, and check the mail log to see whether an email was actually sent?
You might also try changing the notification settings to use a specific email address as the recipient (e.g. a personal gmail account).
I installed the plugin and from the log I can see that:
1/ the e-mail to the user is well sent.
The e-mail notification settings are:
When post status changed to published:
Send notification to an email specified in an email field included in the form:
To:
-- Choose email field --
-- Name field --
-- Lastname field --
2) the e-mail to admin is sent BUT not received. It marks an error but which error exactly is not told.
Hello, I'll be glad to take a closer look. Do you have a staging environment set up where we can test by deactivating other plugins and activating a default theme? If not, can we try those tests in the live site, or would you prefer to clone the site and install the clone in a staging environment?
I created a site clone and I was able to install it locally to run some tests. There are quite a few forms with notifications set up in wp-admin, is there a specific Form and notification I should test?
Okay I ran some tests locally on my site clone, but I was never able to reproduce the error shown in your first test with WP Mail log active. Here are the tests and results shown in the WP Mail log screenshot:
- I edited the Form eigendom-aanpassen and used the "Send a test email" button to test both notifications. In the WP Mail log, I can see that both emails were triggered successfully.
- I edited the post /eigendom/bouwgrond-schoten/ on the front-end of the site using the "Eigendom aanpassen" link and the edit post form here: /eigendom/bouwgrond-schoten/?content-template-id=681. I only made a minor text change in the main content. In the WP mail log, I can see that the first notification was triggered successfully when the Form was submitted. I do not see the same error that was produced during your tests.
- I published two Draft posts from wp-admin to trigger the Eigendom gepubliceerd notification, and both emails were triggered successfully.
- I edited a different post /eigendom/bouwgrond-schoten-2/ on the front-end of the site to test editing a different post and editing more content. I changed several checkboxes and radio buttons, and selected a different Stad in the city-property post relationship input field. When I submitted the Form, again the email notification was triggered successfully.
- If I hover over the error icon in the WP Mail log, I can see the error message: "Could not instantiate wp_mail function". However, I could not reproduce the same error in my local tests.
Can you tell me a bit more information?
1. In the test that produced an error on your live site, did you submit the Form to trigger the email, or did you use the "Send a test email" button to send this email?
2. If you submitted the Form, can you tell me if the same error is produced every time you submit the Form, for any post, with any edits, or is this an isolated problem with only one post, or when a specific input is changed in the Form?
3. Do you have a server-side error log activated on the live site? If so, are there any PHP errors in the logs that correspond to the date/time when this notification failed and produced an error?
4. If you do not have server-side logs active on the live site, it would be helpful to activate them during testing so we can see if there are any server-side errors contributing to this failure. I can show you how to activate a log temporarily if necessary. Go in your wp-config.php file and look for
define('WP_DEBUG', false);
Change it to:
define('WP_DEBUG', true);
Then add these lines, just after the WP_DEBUG line:
Upload the wp-config.php file back to your server, then test editing a post again to trigger the email notification. If any server-side errors are generated, a log file will be created on your server with the file name error_log.txt. It will be in the same directory where you can find wp-config.php in a standard site installation. Please download that file and open it with any text editor. Copy its contents and paste them here for me to review. Then you can delete the error_log.txt file from the server and revert the changes you made in wp-config.php.
1. In the test that produced an error on your live site, did you submit the Form to trigger the email, or did you use the "Send a test email" button to send this email?
---> I submited the form to trigger the email.
2. If you submitted the Form, can you tell me if the same error is produced every time you submit the Form, for any post, with any edits, or is this an isolated problem with only one post, or when a specific input is changed in the Form?
---> For ALL post forms WP mail logging log gives the following error: "could not initaite mail function". This is NOT an isolated problem.
3. Do you have a server-side error log activated on the live site? If so, are there any PHP errors in the logs that correspond to the date/time when this notification failed and produced an error?
There are NO errors from our side.
I hope you can solve this issue very fast because we are stuck due to it.
Okay thank you for the feedback. These conditions make it difficult to diagnose and resolve the issue:
- I cannot troubleshoot or test on the live site, where the problem occurs
- The problem does not occur on a clone of the site installed in a different environment
- The problem produces no PHP errors in the live site logs that would indicate a specific error in Forms
- The message shown in the WP Mail Log dashboard "could not instantiate mail function" is somewhat generic, and may indicate a server configuration or environment compatibility issue: https://docs.acymailing.com/faq/could-not-instantiate-mail-function https://www.thenewsletterplugin.com/sending-tests-error-not-instantiate-mail-function
We can also try one or more of these next steps:
- I can try installing the site clone on another server to see if I can replicate the problem there. I will work on this next.
- If your hosting provider offers the ability to set up a staging environment with an identical server setup, we could try to install a clone of the site on that staging environment and run further tests there without using the live site.
- You could try installing an SMTP plugin and routing emails through an outside email provider like Google/Gmail. For example a plugin like WP Mail SMTP by WPForms: https://wordpress.org/plugins/wp-mail-smtp/
Whatever option we select for all the user forms none of the required email notifications are being sent out.
WP mail logging log keeps displaying that it could not initiate the mail function.
Could you pass this issue on to the developers team and ask them to look into it? They may be able to identify and solve the issue more readily.
The notification emails are now sent out over the suggested plugin https://wordpress.org/plugins/wp-mail-smtp/.
So my issue is resolved.
It still might be advised to pass it on to the developers team to find and solve the issue?
The notification emails are now sent out over the suggested plugin...So my issue is resolved.
Okay great, I'm glad this is now working as expected.
It still might be advised to pass it on to the developers team to find and solve the issue?
Agreed. I have some feedback from our lead developer. A patch file has been provided and we would appreciate your feedback, since the problem cannot be replicated on our servers. Please find the patch file available here: https://drive.google.com/file/d/1Bnth1frHRyJi5Mp3urOYIr5LqzViNp-_/view?usp=sharing
This patch will work with the latest version of Forms (currently 2.6.6). To apply the patch, you must update one plugin file on the server and also add one PHP snippet to activate the solution. Unzip the package and upload the file it contains to the Forms plugin directory on your server at /wp-content/plugins/cred-frontend-editor/application/controllers/notification_manager/
Then, you must either create a custom code snippet to turn on this feature, or you can add a configuration definition to your wp-config.php file. Please choose only one of the following two options:
1. Custom code: Add the following line to your child theme's functions.php file, or create a new code snippet in wp-admin > Toolset > Settings: Custom Code tab. Set the snippet to run everywhere and add the code.
Then you should test again with the SMTP plugin deactivated. Please let me know if the problem is not resolved. If resolved, we will implement this solution in a way that is manageable from the Toolset Settings panel in a future release.