For get email id from string. you heve to set reguler expression.
Below is a exmaple for get email from given string in PHP
<?php $string = "My email id is email@example.com and also second email id is firstname.lastname@example.org"; preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches); print(implode("<br>", $matches)); ?>
If you have any queries, please do not hesitate to contact me at Jainish Senjaliya