diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -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(); +} + } ?> |