email_helper.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. /**
  3. * CodeIgniter
  4. *
  5. * An open source application development framework for PHP 5.1.6 or newer
  6. *
  7. * @package CodeIgniter
  8. * @author EllisLab Dev Team
  9. * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
  10. * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
  11. * @license http://codeigniter.com/user_guide/license.html
  12. * @link http://codeigniter.com
  13. * @since Version 1.0
  14. * @filesource
  15. */
  16. // ------------------------------------------------------------------------
  17. /**
  18. * CodeIgniter Email Helpers
  19. *
  20. * @package CodeIgniter
  21. * @subpackage Helpers
  22. * @category Helpers
  23. * @author EllisLab Dev Team
  24. * @link http://codeigniter.com/user_guide/helpers/email_helper.html
  25. */
  26. // ------------------------------------------------------------------------
  27. /**
  28. * Validate email address
  29. *
  30. * @access public
  31. * @return bool
  32. */
  33. if ( ! function_exists('valid_email'))
  34. {
  35. function valid_email($address)
  36. {
  37. return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
  38. }
  39. }
  40. // ------------------------------------------------------------------------
  41. /**
  42. * Send an email
  43. *
  44. * @access public
  45. * @return bool
  46. */
  47. if ( ! function_exists('send_email'))
  48. {
  49. function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
  50. {
  51. return mail($recipient, $subject, $message);
  52. }
  53. }
  54. /* End of file email_helper.php */
  55. /* Location: ./system/helpers/email_helper.php */