Skip to content

Instantly share code, notes, and snippets.

@tomkrush
Created January 21, 2015 20:08
Show Gist options
  • Save tomkrush/3697777373bbff708cec to your computer and use it in GitHub Desktop.
Save tomkrush/3697777373bbff708cec to your computer and use it in GitHub Desktop.
Override wp_mail
<?php
/**
CREATE TABLE `notifications` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`to` varchar(255) DEFAULT NULL,
`subject` varchar(255) DEFAULT NULL,
`message` text,
`headers` text,
`date` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=latin1;
**/
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
global $wpdb;
$wpdb->insert( 'notifications', array(
'to' => $to,
'subject' => $subject,
'message' => $message,
'headers' => json_encode($headers),
'date' => current_time('mysql', 1)
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment