Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Deprecate the Email helper

  • Loading branch information...
commit 0898e2395df056f5df90a1dd2d5550f0eae4cd7c 1 parent e2b0754
@narfbg narfbg authored
View
12 system/helpers/email_helper.php
@@ -43,7 +43,8 @@
/**
* Validate email address
*
- * @param string
+ * @deprecated 3.0.0 Use PHP's filter_var() instead
+ * @param string $email
* @return bool
*/
function valid_email($email)
@@ -59,12 +60,13 @@ function valid_email($email)
/**
* Send an email
*
- * @param string
- * @param string
- * @param string
+ * @deprecated 3.0.0 Use PHP's mail() instead
+ * @param string $recipient
+ * @param string $subject
+ * @param string $message
* @return bool
*/
- function send_email($recipient, $subject = 'Test email', $message = 'Hello World')
+ function send_email($recipient, $subject, $message)
{
return mail($recipient, $subject, $message);
}
View
1  user_guide_src/source/changelog.rst
@@ -88,6 +88,7 @@ Release Date: Not Released
- :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`.
- Deprecated :doc:`String Helper <helpers/string_helper>` function ``repeater()`` - it's just an alias for PHP's native ``str_repeat()``.
- :doc:`Directory Helper <helpers/directory_helper>` ``directory_map()`` will now append DIRECTORY_SEPARATOR to directory names in the returned array.
+ - Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively.
- Database
View
48 user_guide_src/source/helpers/email_helper.rst
@@ -8,6 +8,8 @@ Class <../libraries/email>`.
.. contents:: Page Contents
+.. important:: The Email helper is DEPRECATED.
+
Loading this Helper
===================
@@ -15,21 +17,21 @@ This helper is loaded using the following code::
$this->load->helper('email');
-
The following functions are available:
-valid_email('email')
-====================
+valid_email()
+=============
-Checks if an email is a correctly formatted email. Note that is doesn't
-actually prove the email will recieve mail, simply that it is a validly
-formed address.
+.. php:function:: valid_email($email)
-It returns TRUE/FALSE
+ :param string $email: Email address
+ :returns: bool
-::
+Checks if the input is a correctly formatted e-mail address. Note that is
+doesn't actually prove that the address will be able recieve mail, but
+simply that it is a validly formed address.
- $this->load->helper('email');
+Example::
if (valid_email('email@somesite.com'))
{
@@ -40,10 +42,26 @@ It returns TRUE/FALSE
echo 'email is not valid';
}
-send_email('recipient', 'subject', 'message')
-=============================================
+.. note:: All that this function does is to use PHP's native ``filter_var()``:
+ |
+ | (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
-Sends an email using PHP's native
-`mail() <http://www.php.net/function.mail>`_ function. For a more robust
-email solution, see CodeIgniter's :doc:`Email
-Class <../libraries/email>`.
+send_email()
+============
+
+.. php:function:: send_email($recipient, $subject, $message)
+
+ :param string $recipient: E-mail address
+ :param string $subject: Mail subject
+ :param string $message: Message body
+ :returns: bool
+
+Sends an email using PHP's native `mail() <http://www.php.net/function.mail>`_
+function.
+
+.. note:: All that this function does is to use PHP's native ``mail``:
+ |
+ | mail($recipient, $subject, $message);
+
+For a more robust email solution, see CodeIgniter's :doc:`Email Library
+<../libraries/email>`.
View
15 user_guide_src/source/installation/upgrade_300.rst
@@ -188,6 +188,21 @@ CodeIgniter 3.1+.
.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner
rather than later.
+Email helper functions
+======================
+
+:doc:`Email Helper <../helpers/email_helper>` only has two functions
+
+ - :php:func:`valid_email()`
+ - :php:func:`send_email()`
+
+Both of them are now aliases for PHP's native ``filter_var()`` and ``mail()`` functions, respectively.
+Therefore the :doc:`Email Helper <../helpers/email_helper>` altogether is being deprecated and
+is scheduled for removal in CodeIgniter 3.1+.
+
+.. note:: These functions are still available, but you're strongly encouraged to remove their usage
+ sooner rather than later.
+
Date helper standard_date()
===========================

4 comments on commit 0898e23

@it-can

so in 3.1 there is no function to validate an email address? you have to create one yourself?

@narfbg
Owner

Did you read the notes at all?

(bool) filter_var($email, FILTER_VALIDATE_EMAIL);

... this is all that valid_email() does.

@CMCDragonkai

Does this affect the Validation Library's option to have valid_email?

@narfbg
Owner

No, the library has its own valid_email() method to be used as a rule.

Please sign in to comment.
Something went wrong with that request. Please try again.