Validate an e-mail address
From Joomla! Documentation
Revision as of 10:59, 21 November 2012 by E-builds
If you want to validate an e-mail address in your code and you will use JMAIL anyway, you can use the function from its parent class phpmailer.
$mail =& JFactory::getMailer(); if (!$mail->ValidateAddress($mailaddress)) echo 'Invalid';
This is implicitly done for every JMAIL function that sets an address (such as addRecipient, addBCC, ..) and though there are other potential errors besides address validating, it most probably is something you want catch too.
$mail =& JFactory::getMailer(); if ($mail->addRecipient($mailaddress)->IsError()) echo 'Invalid';