PHPackages                             oodle/email-parse - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. oodle/email-parse

Abandoned → [mmucklo/email-parse](/?search=mmucklo%2Femail-parse)Library

oodle/email-parse
=================

email-parse a (reasonably) RFC822 / RF2822-compliant library for parsing multiple (and single) email addresses

19.1k1PHP

Since Sep 6Pushed 12y ago2 watchersCompare

[ Source](https://github.com/oodle/email-parse)[ Packagist](https://packagist.org/packages/oodle/email-parse)[ RSS](/packages/oodle-email-parse/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

email-parse
===========

[](#email-parse)

Email\\Parse is a multiple (and single) email address parser that is reasonably RFC822 / RFC2822 compliant.

It parses a list of 1 to n email addresses separated by space or comma

Installation:
-------------

[](#installation)

Add this line to your composer.json "require" section:

### composer.json

[](#composerjson)

```
    "require": {
       ...
       "oodle/email-parse": "*"

```

Usage:
------

[](#usage)

```
use Email\Parse;

$result = Parse::getInstance()->parse("a@aaa.com b@bbb.com");

```

Notes:
======

[](#notes)

This should be RFC 2822 compliant, although it will let a few obsolete RFC 822 addresses through such as test"test" (note the quoted string in the middle of the address, which may be obsolete as of RFC 2822). However it wont allow escaping outside of quotes such as test@. This would have to be written as "test@test"@xyz.com

Here are a few other examples:

```
"John Q. Public"
this.is.an.address@xyz.com
how-about-an-ip@[10.0.10.2]
how-about-comments(this is a comment!!)@xyz.com

```

\####Function Spec####

```
/**
 * function parse($emails, $multiple = true, $encoding = 'UTF-8')
 * @param string $emails List of Email addresses separated by comma or space if multiple
 * @param bool $multiple (optional, default: true) Whether to parse for multiple email addresses or not
 * @param string $encoding (optional, default: 'UTF-8')The encoding if not 'UTF-8'
 * @return: see below: */

    if ($multiple):
         array('success' => boolean, // whether totally successful or not
               'reason' => string, // if unsuccessful, the reason why
               'email_addresses' =>
                    array('address' => string, // the full address (not including comments)
                        'original_address' => string, // the full address including comments
                        'simple_address' => string, // simply local_part@domain_part (e.g. someone@oodle.com)
                         'name' => string, // the name on the email if given (e.g.: John Q. Public), including any quotes
                         'name_parsed' => string, // the name on the email if given (e.g.: John Q. Public), excluding any quotes
                        'local_part' => string, // the local part (before the '@' sign - e.g. johnpublic)
                        'local_part_parsed' => string, // the local part (before the '@' sign - e.g. johnpublic), excluding any quotes
                        'domain' => string, // the domain after the '@' if given
                         'ip' => string, // the IP after the '@' if given
                         'domain_part' => string, // either domain or IP depending on what given
                        'invalid' => boolean, // if the email is valid or not
                        'invalid_reason' => string), // if the email is invalid, the reason why
                    array( .... ) // the next email address matched
        )
    else:
        array('address' => string, // the full address including comments
            'name' => string, // the name on the email if given (e.g.: John Q. Public)
            'local_part' => string, // the local part (before the '@' sign - e.g. johnpublic)
            'domain' => string, // the domain after the '@' if given
            'ip' => string, // the IP after the '@' if given
            'invalid' => boolean, // if the email is valid or not
            'invalid_reason' => string) // if the email is invalid, the reason why
    endif;

```

Other Examples:
---------------

[](#other-examples)

```
 $email = "\"J Doe\" ";
 $result = Email\Parse->getInstance()->parse($email, false);

 $result == array('address' => '"JD" ',
          'original_address' => '"JD" ',
          'name' => '"JD"',
          'name_parsed' => 'J Doe',
          'local_part' => 'johndoe',
          'local_part_parsed' => 'johndoe',
          'domain_part' => 'xyz.com',
          'domain' => 'xyz.com',
          'ip' => '',
          'invalid' => false,
          'invalid_reason' => '');

 $emails = "testing@[10.0.10.45] testing@xyz.com, testing-"test...2"@xyz.com (comment)";
 $result = Email\Parse->getInstance()->parse($emails);
 $result == array(
            'success' => boolean true
            'reason' => null
            'email_addresses' =>
                array(
                array(
                    'address' => 'testing@[10.0.10.45]',
                    'original_address' => 'testing@[10.0.10.45]',
                    'name' => '',
                    'name_parsed' => '',
                    'local_part' => 'testing',
                    'local_part_parsed' => 'testing',
                    'domain_part' => '10.0.10.45',
                    'domain' => '',
                    'ip' => '10.0.10.45',
                    'invalid' => false,
                    'invalid_reason' => ''),
                array(
                    'address' => 'testing@xyz.com',
                    'original_address' => 'testing@xyz.com',
                    'name' => '',
                    'name_parsed' => '',
                    'local_part' => 'testing',
                    'local_part' => 'testing',
                    'domain_part' => 'xyz.com',
                    'domain' => 'xyz.com',
                    'ip' => '',
                    'invalid' => false,
                    'invalid_reason' => '')
                array(
                    'address' => '"testing-test...2"@xyz.com',
                    'original_address' => 'testing-"test...2"@xyz.com (comment)',
                    'name' => '',
                    'name_parsed' => '',
                    'local_part' => '"testing-test2"',
                    'local_part_parsed' => 'testing-test...2',
                    'domain_part' => 'xyz.com',
                    'domain' => 'xyz.com',
                    'ip' => '',
                    'invalid' => false,
                    'invalid_reason' => '')
                )
            );

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f05a1e018633083f2618b189473318e14d14d921216188d36c52e582244340c7?d=identicon)[mmucklo](/maintainers/mmucklo)

---

Top Contributors

[![mmucklo](https://avatars.githubusercontent.com/u/245122?v=4)](https://github.com/mmucklo "mmucklo (7 commits)")

### Embed Badge

![Health badge](/badges/oodle-email-parse/health.svg)

```
[![Health](https://phpackages.com/badges/oodle-email-parse/health.svg)](https://phpackages.com/packages/oodle-email-parse)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
