Skip to content

Instantly share code, notes, and snippets.

@tomkrush
Created February 20, 2012 14:23
Show Gist options
  • Save tomkrush/1869449 to your computer and use it in GitHub Desktop.
Save tomkrush/1869449 to your computer and use it in GitHub Desktop.
<?php
if ( ! function_exists('mailer') )
{
function mailer($to, $from, $subject, $template, $data = array())
{
$headers = "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "From: {$from}\r\n";
$path = get_theme_root() . '/' . get_template() . '/';
ob_start();
extract($data);
require($path."emails/{$template}.php");
$message = ob_get_contents();
ob_clean();
mail($to, $subject, $message, $headers);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment