blob: 0516e938a98833d605ff616ed7c8063de5cd603b [file] [log] [blame]
Andrey Andreev8bf6bb62012-01-06 16:11:04 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev8bf6bb62012-01-06 16:11:04 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev8bf6bb62012-01-06 16:11:04 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
Derek Allard2067d1a2008-11-13 22:59:24 +000028/**
29 * CodeIgniter Email Helpers
30 *
31 * @package CodeIgniter
32 * @subpackage Helpers
33 * @category Helpers
Derek Jonesf4a4bd82011-10-20 12:18:42 -050034 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000035 * @link http://codeigniter.com/user_guide/helpers/email_helper.html
36 */
37
38// ------------------------------------------------------------------------
39
Derek Allard2067d1a2008-11-13 22:59:24 +000040if ( ! function_exists('valid_email'))
41{
Timothy Warren01b129a2012-04-27 11:36:50 -040042 /**
43 * Validate email address
44 *
45 * @param string
46 * @return bool
47 */
Derek Allard2067d1a2008-11-13 22:59:24 +000048 function valid_email($address)
49 {
Andrey Andreev8bf6bb62012-01-06 16:11:04 +020050 return (bool) preg_match('/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $address);
Derek Allard2067d1a2008-11-13 22:59:24 +000051 }
52}
53
54// ------------------------------------------------------------------------
55
Derek Allard2067d1a2008-11-13 22:59:24 +000056if ( ! function_exists('send_email'))
57{
Timothy Warren01b129a2012-04-27 11:36:50 -040058 /**
59 * Send an email
60 *
61 * @param string
62 * @param string
63 * @param string
64 * @return bool
65 */
Derek Allard2067d1a2008-11-13 22:59:24 +000066 function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
67 {
68 return mail($recipient, $subject, $message);
69 }
70}
71
Derek Allard2067d1a2008-11-13 22:59:24 +000072/* End of file email_helper.php */
Andrey Andreevb2518642012-03-26 21:44:08 +030073/* Location: ./system/helpers/email_helper.php */