Extract Email Addresses

PHOTO EMBED

Mon Jun 22 2020 13:14:31 GMT+0000 (Coordinated Universal Time)

Saved by @Amna #php

function extract_emails_from($string) {
         preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
         return $matches[0];
}
content_copyCOPY

Just pass the string (e.g. the body part of an email) to the function, and it returns an array of Email Addresses contained in the String.

https://css-tricks.com/snippets/php/extract-email-addresses/