- August 20, 2021
- Posted by: Editor
- Categories: eCommerce, PHP, WordPress
No Comments
WordPress plugin WP Delayed Mail lets you send an email at a later time. Why would you need to do this? Well if you’re running an online store you may come across a need where you would like to follow up with a customer after a specific period of time such as after a purchase or after registration.
This plugin allows you to add code to be send an email at a later time
To use it, pass the same arguments you would to wp_mail()
instead to wp_delayed_mail()
, except make the first argument the time at which you want the email to be sent, in a Unix timestamp.
For example, to send an email immediately in WordPress, you would usually do the following:
wp_mail(
'recipient@example.com',
'Subject',
'Hi, there!'
);
To send it instead four hours later using wp_delayed_mail
wp_delayed_mail(
time() + ( 60 * 60 * 4 ),
'recipient@example.com',
'My Subject',
'Hello! How are you?'
);