Email Helper¶
The Email Helper provides some assistive functions for working with Email. For a more robust email solution, see CodeIgniter’s Email Class.
Page Contents
Important
The Email helper is DEPRECATED.
Loading this Helper¶
This helper is loaded using the following code:
$this->load->helper('email');
The following functions are available:
valid_email()¶
- valid_email($email)¶
Parameters: - $email (string) – 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.
Example:
if (valid_email('email@somesite.com'))
{
echo 'email is valid';
}
else
{
echo 'email is not valid';
}
Note
All that this function does is to use PHP’s native filter_var(): | | (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
send_email()¶
- send_email($recipient, $subject, $message)¶
Parameters: - $recipient (string) – E-mail address
- $subject (string) – Mail subject
- $message (string) – Message body
Returns: bool
Sends an email using PHP’s native 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 Email Library.