PHPackages                             michaelesmith/email-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. michaelesmith/email-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

michaelesmith/email-parser
==========================

Parse an email into an object representation

1257.5k↓37.5%7[2 PRs](https://github.com/michaelesmith/EmailParser/pulls)PHP

Since Feb 11Pushed 9y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a1ce0d8884d2586196cdc094e45c44f69df9be7d285a9a362c653d2b84335d24/68747470733a2f2f7472617669732d63692e6f72672f6d69636861656c65736d6974682f456d61696c5061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/michaelesmith/EmailParser)

README
======

[](#readme)

What is msEmailParser?
----------------------

[](#what-is-msemailparser)

A utility to parse incoming emails into an object representation. This uses some of the tests from  and is heavily inspired by

Installation
------------

[](#installation)

### Use Composer (*recommended*)

[](#use-composer-recommended)

The recommended way to install msDateTime is through composer.

If you don't have Composer yet, download it following the instructions on  or just run the following command:

```
curl -s http://getcomposer.org/installer | php

```

Just create a `composer.json` file for your project:

```
{
    "require": {
        "michaelesmith/email-parser": "*"
    }
}
```

For more info on composer see

Examples
--------

[](#examples)

\###Basic

```
$parser = new \MS\Email\Parser\Parser();
$message = $parser->parse($email);

// address object
$message->getFrom();

// email address
$message->getFrom()->getAddress();

// name if given
$message->getFrom()->getName();

// date sent
$message->getDate()

// date sent as DateTime object (PHP 5.3+)
$message->getDateAsDateTime()

// string
$message->getSubject();

// decoded plain text part
$message->getTextBody();

// decoded html body part
$message->getHtmlBody();

// attachments
$attachments = $message->getAttachments();
// attachment object
$attachments[0]
// methods
$attachments[0]->getFilename();
$attachments[0]->getMimeType();
// decoded attachment content
$attachments[0]->getContent();

```

\###Encodings supported

```
* base64
* quoted-printable
* 7bit
* 8bit

```

More usage can be found in the tests

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/181546?v=4)[Michael Smith](/maintainers/michaelesmith)[@michaelesmith](https://github.com/michaelesmith)

---

Top Contributors

[![michaelesmith](https://avatars.githubusercontent.com/u/181546?v=4)](https://github.com/michaelesmith "michaelesmith (11 commits)")[![SebSept](https://avatars.githubusercontent.com/u/2592502?v=4)](https://github.com/SebSept "SebSept (3 commits)")[![skeemer](https://avatars.githubusercontent.com/u/864069?v=4)](https://github.com/skeemer "skeemer (3 commits)")

### Embed Badge

![Health badge](/badges/michaelesmith-email-parser/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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