In PHP, I have a string like this:
$string = "user@domain.com MIME-Version: bla bla bla";
How do i get the email address only? Is there any easy way to get the value??
In PHP, I have a string like this:
$string = "user@domain.com MIME-Version: bla bla bla";
How do i get the email address only? Is there any easy way to get the value??
If the email address is always at the front of the string, the easiest way to get it is simply to split the string on all instances of the space character, and then just take the first value from the resulting array.
Of course, make sure to check it is something resembling an email address before you use it.
See the PHP 'split' function for details.