openmindculture / wp-contact-form-inbox-report-mailer-plugin

Send email reports of contact form inbox entries, including possible spam. Requires Contact Form 7 and Flamingo plugins! This is free software as-is with absolutely no warranty! Feel free to contribute on GitHub to report problems and add missing features!
GNU General Public License v3.0
0 stars 0 forks source link

WP cron schedule not sending mail #3

Open openmindculture opened 1 year ago

openmindculture commented 1 year ago

Mail function works when called from an admin page, but does not seem to work inside a cron schedule callback.

Maybe it does and it's a permission issue that we don't get any inbox entries?

Always send a mail, with or without a report.

Set schedule interval to hourly for testing purposes.

openmindculture commented 1 year ago

https://dev.to/ingosteinke/wp-schedule-event-role-and-permissions-da7

openmindculture commented 1 year ago

Tried various things

It seems that the cron schedule callback is not executed when called by cron, but if it was, it would not have sufficient permissions to generate a report.

openmindculture commented 1 year ago

Got some erractic inbox mails obviously sent via scheduled callback about 2 days after setting hourly schedule! New hypothesis: maybe a caching issue?

Cron scheduled as hourly: 20231009 Cron mail received: 20231011-19:11 Cron mail received: 20231011-19:52

Caching disabled: 20231011-20:41

Cron mail received: 20231011-20:50 Cron mail received: 20231011-21:50

Caching reenabled with page cache only: 20231011-21:56

W3 Total Cache Configuration before deactivation:

Not enabled: Database Cache, CDN, Reverse Proxy, Fragment Cache, Miscellaneous, Debug

openmindculture commented 1 year ago

Follow-up: watch inbox after reenabling, verify with different caching options, await support: https://wordpress.org/support/topic/wp-cron-callbacks-not-executed/

openmindculture commented 1 year ago

No more scheduled mails after reactivating page cache.

openmindculture commented 1 year ago

Caching changed: 20231012-1944 Page cache disabled, frontend minify disabled, object cache stays enabled, browser cache stays enabled

openmindculture commented 1 year ago

WordPress core update to 6.3.2 on Friday 20231013 Unchanged settings, Scheduled callback triggered mails 20131015-0350 20131015-0451 20131015-0550 20131015-0650 20131015-0850 20131015-1051 20131015-1150

openmindculture commented 1 year ago

received mails hourly, switch to twice daily

openmindculture commented 1 year ago

reenabled W3TC page cache, set interval to hourly

Oct 16, 2023, 11:24 Can’t reproduce the issue anymore. About 1 day after WordPress core update to 6.3.2 cron suddenly worked as expected without any settings changed.

I will reenable page cache now and see if it occurs again.

Oct 18: No more cron since I activated page cache.

openmindculture commented 1 year ago

The situation is getting even more erratic. I didn't touch any settings and didn't explicitly clear the cache; WP core and W3TC is still the same since my last comment. But since tonight 3:05 a.m. I receive scheduled report mails again. Despite the expected hourly schedule, probably due to low traffic page visitors, these are the successful callback times so far: 02:53 03:05 04:12 04:16 05:04 05:19 05:53 06:06 06:55 07:05 07:50 08:07 08:56 09:06 09:55 09:56 10:02 10:04

openmindculture commented 1 year ago

I have installed the same plugin on another site which also uses W3 TC page cache now.

openmindculture commented 1 year ago

After talking to myself in support issues, like I often do, while nobody seems to be able to help, I will test alternative solutions:

openmindculture commented 1 year ago

Manual call of the wp-cron.php URL does not trigger sending a mail either:

Disable W3TC. (Possibly install WP Super Cache ...

Try above wp-cron call... does not work either!

Try the logged in plugin page: https://www.open-mind-culture.org/wp-admin/admin.php?page=contact-form-inbox-report-mailer

No mail either. So that's the problem after the latest update?

openmindculture commented 1 year ago

More debug info, installed and rescheduled, send on view admin page works again, at least sometimes, erratically, unless wp_mail returns false. Live testing since Monday noon, 30. October 2023:

openmindculture commented 1 year ago

Current status:

openmindculture commented 1 year ago

Warning (found on the UpdraftPlus backup page, K.O. page):

Warnung: WordPress has a number (5) of scheduled tasks which are overdue. Unless this is a development site, this means that the scheduler in your WordPress install is not working properly