I have a website in CodeIgniter 3. I have a login and register form.
In Register form, I am using CodeIgniter validation rules for validating user inputs. Other are fine, I just want to talk about the email validation rule
. Here is how I am doing this
$this->form_validation->set_rules('email', 'Email Address', 'trim|required|max_length[60]|valid_email|xss_clean|unique[user.email]');
And in HTML I have used the Input type
attribute email
. This attribute forces normal users to enter valid email addresses that's fine. But when I remove this email
attribute, I am able to enter this as an email,
"<!sadasdd_?"@gmail.com
How is this a valid email? How do you validate email? and how can I prevent such spam inputs?