Published on
You can use Clientside JavaScript validation to do a first check on whether an email address is valid or not but that is easily by-passed so you need to add a Serverside validation check as well.
Is the address a valid email address
The Auto Serverside validation action has an option that allows you to check for a valid email address format. This check only looks at the format of the address to see if it looks correct. I tdoes not guarantee that the address exists or is working. Technically it's very difficult to check for 'all' valid email addresse formats but this will check for pretty much any 'normal' email address format.
You can also use a Custom Serverside validation action to add finer filters:
Check in each case that 'email' is replaced by the name of the email input in your form.
Exclude addresses from these domains
<?php $exclude_array = array( 'domain_a.com', 'domain-b.com, 'domainc.com' ); foreach ( $exclude_array as $d ) { if ( strpos($form->data['email'], $d) !== false ) { $form->validation_errors['email'] = "Invalid email."; return false; } } ?>
Only permit addresses from this domain
<?php if ( strpos($form->data['email'], 'domain.com' ) === false ) { $form->validation_errors['email'] = "Invalid email."; return false; } ?>
For more information on using the Custom Serverside Validation action see this FAQ
Comments: