PHPackages                             jungleran/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. jungleran/email-parse

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

jungleran/email-parse
=====================

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

2.2.3(1y ago)0647MITPHPPHP &gt;=8.2

Since Jul 8Pushed 1y agoCompare

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

READMEChangelogDependencies (6)Versions (22)Used By (0)

email-parse [![Build Status](https://camo.githubusercontent.com/5cfc0c2d193b534f77d6a8d99afba7697cca57a3738633c4db9e876523954ce9/68747470733a2f2f7472617669732d63692e6f72672f6d6d75636b6c6f2f656d61696c2d70617273652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mmucklo/email-parse)
====================================================================================================================================================================================================================================================================================================

[](#email-parse-)

Email\\Parse is a multiple (and single) batch 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": {
       ...
       "mmucklo/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"test@xyz.com` (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@test@xyz.com`. 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-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@somewhere.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

39

—

LowBetter than 86% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 81.7% 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.

###  Release Activity

Cadence

Every ~249 days

Total

14

Last Release

724d ago

Major Versions

0.4.3 → 1.0.02015-09-15

1.0.0 → 2.0.02017-04-15

PHP version history (4 changes)0.2.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6.0

2.1.0PHP &gt;=7.1

2.2.2PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3cf4ebd9bedf6084a094cf15d5ca31a08683c6e7f15f0cc7acffc89e8fbea27e?d=identicon)[jungleran](/maintainers/jungleran)

---

Top Contributors

[![mmucklo](https://avatars.githubusercontent.com/u/245122?v=4)](https://github.com/mmucklo "mmucklo (49 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![mkraemer](https://avatars.githubusercontent.com/u/1070200?v=4)](https://github.com/mkraemer "mkraemer (2 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (2 commits)")[![ranqiangjun](https://avatars.githubusercontent.com/u/5101533?v=4)](https://github.com/ranqiangjun "ranqiangjun (2 commits)")[![ArthurHoaro](https://avatars.githubusercontent.com/u/1962678?v=4)](https://github.com/ArthurHoaro "ArthurHoaro (1 commits)")[![arnested](https://avatars.githubusercontent.com/u/190005?v=4)](https://github.com/arnested "arnested (1 commits)")

---

Tags

emailparseRFC822RFC2822email-parsemultiple-emailbatch-email

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[mmucklo/email-parse

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

46837.3k2](/packages/mmucklo-email-parse)[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[voku/email-check

email-check (syntax, dns, trash, ...) library

504.1M4](/packages/voku-email-check)[omnimail/omnimail

PHP Library to send email across all platforms using one interface.

32934.3k](/packages/omnimail-omnimail)[vaibhavpandeyvpz/phemail

A pure PHP MIME parser for parsing raw email files (.eml) with full support for multipart messages, nested structures, and RFC 2046 compliance.

33121.7k1](/packages/vaibhavpandeyvpz-phemail)

PHPackages © 2026

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