AnimaSola
AnimaSola

Reputation: 7856

Wordpress Plug-in - Trigger e-mail based on a specific date

I currently have a registration form for people to signup and pick a date for an "appointment". They get sent an e-mail right after filling it up with the details. I need another e-mail to be sent a day before their chosen date to remind them, but that can't be fulfilled by plugins I currently have.

Does anyone know of any Wordpress plug-in that allows the sending of an e-mail message (with a template and user specific data) based on a specified date?

Any piece of information or advice would be highly appreciated. Thanks!

Upvotes: 0

Views: 4876

Answers (3)

Shawn Wernig
Shawn Wernig

Reputation: 1742

How I would approach this would be with Wordpresses event scheduling. When a user submits the form to schedule their appointment, set a new action for the reminder email:

// Set this when you send the confirmation email
// Set the $unix_timestamp to be whenever you want the reminder to be sent.
// Args can be an array of the data you will need. Such as the users email/appt date
$args = array(
 'email' => '[email protected]'
);
wp_schedule_single_event($unix_timestamp, 'set_reminder', $args);

Now we have to catch that, and create a function to actually create and send the email (assuming you use a similar process):

add_action('set_reminder','do_reminder');

function do_reminder($args) {
// $email = $args['email'], etc.
// send reminder email.
}

Upvotes: 2

Nikola Ivanov Nikolov
Nikola Ivanov Nikolov

Reputation: 5062

If you are comfortable with writing your own code(I guess you are more or less ok with that), you can use the WordPress Schedule API(okay, maybe that's not the official name, but it works). Basically it's kind of a cron-job, but for WordPress. It has one downside though - it will only trigger on time, if WordPress is rendered(in other words accessed, so that it's code will execute). That can be easily fixed by adding a simple cron-job to your hosting account, that will simply access your home page every X hours.

You can find useful information on the API here.

Basically what you should have inside of your scheduled function is to get the records of people that should be sent reminder emails(you should probably store additional information about whether a reminder email has been sent or not) and send them the emails. I don't know what is the way you're storing the information from the registration form, but if you are using a Custom Post Type, then things should be pretty easy for you.

Upvotes: 1

Kaleem Sajid
Kaleem Sajid

Reputation: 230

I recommend Wysija Newsletters. You http://wordpress.org/extend/plugins/wysija-newsletters/. You can use template and user specific data in your email with this plugin.

Upvotes: 1

Related Questions