summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-01-19 20:41:54 +0100
committerDerek Allard <derek.allard@ellislab.com>2008-01-19 20:41:54 +0100
commit5a34f04129f97fff9f6a3f8b9d02bf724134cd06 (patch)
treeac4cf892d160c57a734a548ce75943a092a478e4 /system/helpers
parentca06da4b58aa38617ee8bb2f4c4d5c6a58e59db0 (diff)
added email helper
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/email_helper.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
new file mode 100644
index 000000000..3729e042f
--- /dev/null
+++ b/system/helpers/email_helper.php
@@ -0,0 +1,54 @@
+<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2006, EllisLab, Inc.
+ * @license http://www.codeigniter.com/user_guide/license.html
+ * @link http://www.codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Email Helpers
+ *
+ * @package CodeIgniter
+ * @subpackage Helpers
+ * @category Helpers
+ * @author ExpressionEngine Dev Team
+ * @link http://www.codeigniter.com/user_guide/helpers/email_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Validate email address
+ *
+ * @access public
+ * @return bool
+ */
+function valid_email($address)
+{
+ return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Send an email
+ *
+ * @access public
+ * @return bool
+ */
+function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
+{
+ return mail($recipient, $subject, $message);
+}
+
+?> \ No newline at end of file