EMailHelperFunctions
a phpmae:Class in Lukas Rosenstock
Public PHP Methods
-
getDisplayName($rfc_email_string)Get a display name from an RFC string.
@param string $rfc_email_string
@return string -
getEMail($rfc_email_string)Helper function to get an email from an RFC string.
taken from: http://php.net/manual/en/function.mailparse-rfc822-parse-addresses.php
@param string $rfc_email_string
@return string
Source Code
<?php
/**
* Implementation for coid://lukasrosenstock.net/EMailHelperFunctions
*/
class EMailHelperFunctions {
/**
* Get a display name from an RFC string.
*
* @param string $rfc_email_string
* @return string
*/
public function getDisplayName($rfc_email_string) {
// taken from: http://php.net/manual/en/function.mailparse-rfc822-parse-addresses.php
preg_match('/[\w\s]+/', $rfc_email_string, $matches);
return (count($matches) > 0) ? trim($matches[0]) : "";
}
/**
* Helper function to get an email from an RFC string.
* taken from: http://php.net/manual/en/function.mailparse-rfc822-parse-addresses.php
* @param string $rfc_email_string
* @return string
*/
public function getEMail($rfc_email_string) {
// taken from: http://php.net/manual/en/function.mailparse-rfc822-parse-addresses.php
preg_match('/(?:<)(.+)(?:>)$/', $rfc_email_string, $matches);
return (count($matches) > 1) ? trim($matches[1]) : trim($rfc_email_string);
}
}
Meta
- URI / COID
- coid://lukasrosenstock.net/EMailHelperFunctions content_copy
- Revision
- 6-3bdf1131b7e946864a7ec68cc88001bf content_copy
- Short ID
- llr:EMailHelperFunctions content_copy
- Reference URL
- https://coid.link/lukasrosenstock.net/EMailHelperFunctions content_copy
- Last updated
- 2021-05-10 08:01 (UTC)
- Created at
- 2021-05-10 08:01 (UTC)