Skip to content

Instantly share code, notes, and snippets.

@anthonybudd
Last active March 10, 2018 17:41
Show Gist options
  • Save anthonybudd/e3173815d82eb619034038de5e92e600 to your computer and use it in GitHub Desktop.
Save anthonybudd/e3173815d82eb619034038de5e92e600 to your computer and use it in GitHub Desktop.
<?php
Class ContactFormAction extends WP_AJAX{
protected $action = 'contat-form';
protected function run(){
WP_Mail::init()
->to('[email protected]')
->subject('New contact from enquiry: {{name}}')
->template(get_template_directory() .'/emails/contact.html', [
'time' => date('Y-m-d H:i:s'),
'name' => $this->get('full_name'),
'email' => $this->get('email'),
'message' => $this->get('message'),
])
->send();
}
}
ContactFormAction::listen();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment