summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class17
1 files changed, 15 insertions, 2 deletions
diff --git a/it.class b/it.class
index 6fc2d9c..4dd4d4d 100644
--- a/it.class
+++ b/it.class
@@ -361,12 +361,12 @@ function replace($replacements, $string, $p = array())
/**
* Extract key => value pairs from assoc array by key
* @param $array array to filter
- * @param $keys array of keys to keep
+ * @param $keys array or comma separated list of keys to keep
*/
function filter_keys($array, $keys)
{
$result = array();
- $keep = array_flip($keys);
+ $keep = array_flip(is_string($keys) ? explode(",", $keys) : (array)$keys);
foreach ($array as $key => $val)
if (isset($keep[$key]))
@@ -658,6 +658,19 @@ function map($expr, $arr)
return (array)$result;
}
+/**
+ * Send a mail. Expects array for Header => Content pairs with Body => for the mail body
+ */
+function mail($p)
+{
+ $body = $p['Body'];
+ unset($p['Body']);
+ $mail = new it_mail($p);
+ $mail->add_body($body);
+
+ return $mail->send();
+}
+
}
?>