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

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

jfoucher/email-parser
=====================

Parse an email into an object representation

0.4.1(7y ago)13522MITPHPPHP &gt;=5.3.2

Since Mar 1Pushed 5y ago1 watchersCompare

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

READMEChangelog (5)Dependencies (1)Versions (3)Used By (2)

[![Build Status](https://camo.githubusercontent.com/d98421f914ee450c1ec94316ccfceca471422960e160354cfbbb5fb60f336912/68747470733a2f2f7472617669732d63692e6f72672f6a666f75636865722f456d61696c5061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jfoucher/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 msEmailParser 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

[](#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

[](#encodings-supported)

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

```

More usage can be found in the tests

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.8% 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 ~0 days

Total

2

Last Release

2631d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a214dd3e770b8f6e835a86d87e0da2321ef2cdddc15fdcd4fb98327562587a3?d=identicon)[jfoucher](/maintainers/jfoucher)

---

Top Contributors

[![jfoucher](https://avatars.githubusercontent.com/u/152015?v=4)](https://github.com/jfoucher "jfoucher (23 commits)")[![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)")[![manhart](https://avatars.githubusercontent.com/u/46067874?v=4)](https://github.com/manhart "manhart (2 commits)")

---

Tags

emailparse

### Embed Badge

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

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

###  Alternatives

[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[sendgrid/sendgrid

This library allows you to quickly and easily send emails through Twilio SendGrid using PHP.

1.5k47.5M164](/packages/sendgrid-sendgrid)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94944.1M110](/packages/pelago-emogrifier)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48419.5M75](/packages/soundasleep-html2text)[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)

PHPackages © 2026

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