WordPress Email on Activation
- 13 April, 2012 -
- WordPress Plugins -
- Tags :
- 0 Comments
A few linesĀ of code that you can add to your plugin to get it to email you when someone activates it.
register_activation_hook(__FILE__, 'tracking');
function tracking()
{
$to = "you@email.com";
$subject = 'Install of [Plugin Name] from '.$_SERVER['SERVER_NAME'];
$message = '
<html>
<head>
<title>'.$subject.'</title>
</head>
<body>
<h1>'.$subject.'</h1>
</body>
</html>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: No Reply <me@mysite.com>' . "\r\n";
mail($to, $subject, $message, $headers);
}