/halogy/helpers/email_helper.php

https://bitbucket.org/haloweb/halogy-1.0/ · PHP · 62 lines · 15 code · 8 blank · 39 comment · 3 complexity · f4af6c4e9c6967d9e7f4b3725d5d0a8d MD5 · raw file

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