Assuming the email address is valid, this textual approach should work:
$prefix = substr($email, 0, strrpos($email, '@'));
It takes everything up to (but not including) the last occurrence of @
. It uses the last occurrence because this email address is valid:
"foo\@bar"@iana.org
If you haven't validated the string yet, I would advice using a filter function:
if (($email = filter_var($email, FILTER_VALIDATE_EMAIL)) !== false) {
// okay, should be valid now
}