blob: b38e7ec46e6f71bb7425d49247d094ccabbcf362 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001############
2Email Helper
3############
4
5The Email Helper provides some assistive functions for working with
6Email. For a more robust email solution, see CodeIgniter's :doc:`Email
7Class <../libraries/email>`.
8
9.. contents:: Page Contents
10
Andrey Andreev0898e232012-11-08 15:13:52 +020011.. important:: The Email helper is DEPRECATED.
12
Derek Jones8ede1a22011-10-05 13:34:52 -050013Loading this Helper
14===================
15
16This helper is loaded using the following code::
17
18 $this->load->helper('email');
19
Derek Jones8ede1a22011-10-05 13:34:52 -050020The following functions are available:
21
Andrey Andreev0898e232012-11-08 15:13:52 +020022valid_email()
23=============
Derek Jones8ede1a22011-10-05 13:34:52 -050024
Derek Jonesb8c283a2013-07-19 16:02:53 -070025.. function:: valid_email($email)
Derek Jones8ede1a22011-10-05 13:34:52 -050026
Andrey Andreev0898e232012-11-08 15:13:52 +020027 :param string $email: Email address
28 :returns: bool
Derek Jones8ede1a22011-10-05 13:34:52 -050029
Andrey Andreev0898e232012-11-08 15:13:52 +020030Checks if the input is a correctly formatted e-mail address. Note that is
31doesn't actually prove that the address will be able recieve mail, but
32simply that it is a validly formed address.
Derek Jones8ede1a22011-10-05 13:34:52 -050033
Andrey Andreev0898e232012-11-08 15:13:52 +020034Example::
Derek Jones8ede1a22011-10-05 13:34:52 -050035
36 if (valid_email('email@somesite.com'))
37 {
38 echo 'email is valid';
39 }
40 else
41 {
42 echo 'email is not valid';
43 }
44
Andrey Andreev0898e232012-11-08 15:13:52 +020045.. note:: All that this function does is to use PHP's native ``filter_var()``:
46 |
47 | (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
Derek Jones8ede1a22011-10-05 13:34:52 -050048
Andrey Andreev0898e232012-11-08 15:13:52 +020049send_email()
50============
51
Derek Jonesb8c283a2013-07-19 16:02:53 -070052.. function:: send_email($recipient, $subject, $message)
Andrey Andreev0898e232012-11-08 15:13:52 +020053
54 :param string $recipient: E-mail address
55 :param string $subject: Mail subject
56 :param string $message: Message body
57 :returns: bool
58
59Sends an email using PHP's native `mail() <http://www.php.net/function.mail>`_
60function.
61
62.. note:: All that this function does is to use PHP's native ``mail``:
63 |
64 | mail($recipient, $subject, $message);
65
66For a more robust email solution, see CodeIgniter's :doc:`Email Library
67<../libraries/email>`.