I would like to ask if there is a way to automatically delay emails after completion?
I want these emails to arrive 1-2 hours later.
Is there a snippet of code for this?
Thank you!
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communitynot tested but maybe you could simply use sleep using wpcf7_before_send_email
something like this:
add_action("wpcf7_before_send_mail", "wpcf7_pause_send");
function wpcf7_pause_send($cf7) {
sleep(3600);
}
I don't know CF7 well enough to give you specifics, but I think you'll need to
Alternatively depending on how you're sending emails you may be able to generate them on the initial form submission to be sent later, e.g. if you're sending them through Outlook.com or if your wp_mail hander has built-in retry and scheduling (as I'd guess WP Offload SES might?)
In some cases, if you are not logged in on your site your form doesn't get submitted. Try submitting the form being logged in on site.