email_helper.php

Go to the documentation of this file.
00001 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002 /**
00003  * CodeIgniter
00004  *
00005  * An open source application development framework for PHP 4.3.2 or newer
00006  *
00007  * @package             CodeIgniter
00008  * @author              ExpressionEngine Dev Team
00009  * @copyright   Copyright (c) 2008, EllisLab, Inc.
00010  * @license             http://codeigniter.com/user_guide/license.html
00011  * @link                http://codeigniter.com
00012  * @since               Version 1.0
00013  * @filesource
00014  */
00015 
00016 // ------------------------------------------------------------------------
00017 
00018 /**
00019  * CodeIgniter Email Helpers
00020  *
00021  * @package             CodeIgniter
00022  * @subpackage  Helpers
00023  * @category    Helpers
00024  * @author              ExpressionEngine Dev Team
00025  * @link                http://codeigniter.com/user_guide/helpers/email_helper.html
00026  */
00027 
00028 // ------------------------------------------------------------------------
00029 
00030 /**
00031  * Validate email address
00032  *
00033  * @access      public
00034  * @return      bool
00035  */     
00036 if ( ! function_exists('valid_email'))
00037 {
00038         function valid_email($address)
00039         {
00040                 return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
00041         }
00042 }
00043 
00044 // ------------------------------------------------------------------------
00045 
00046 /**
00047  * Send an email
00048  *
00049  * @access      public
00050  * @return      bool
00051  */     
00052 if ( ! function_exists('send_email'))
00053 {
00054         function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
00055         {
00056                 return mail($recipient, $subject, $message);
00057         }
00058 }
00059 
00060 
00061 /* End of file email_helper.php */
00062 /* Location: ./system/helpers/email_helper.php */