PHPackages                             phpbook/email - 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. phpbook/email

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

phpbook/email
=============

PHP Email Library For AWSSES, MAILGUN, SMTP, SPARKPOST

1.0.9(3y ago)155MITPHPPHP &gt;=7.1.0

Since Jun 14Pushed 3y agoCompare

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

READMEChangelog (10)DependenciesVersions (11)Used By (0)

- [About Email](#about-email)
- [Composer Install](#composer-install)
- [Declare Configurations](#declare-configurations)
- [Sending Emails](#sending-emails)

### About Email

[](#about-email)

- A lightweight e-mail PHP library available for SMTP, AWSSES, MAILGUN AND SPARKPOST
- Requires PHP Extension FINFO.

### Composer Install

[](#composer-install)

```
composer require phpbook/email

```

### Declare Configurations

[](#declare-configurations)

```
/********************************************
 *
 *  Declare Configurations
 *
 * ******************************************/

//Driver connection SMTP

\PHPBook\Email\Configuration\Email::setConnection('main',
	(new \PHPBook\Email\Configuration\Connection)
		->setName('Main')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook Email does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\Email\Driver\SMTP)
			->setHost('host')
			->setPort(100)
			->setUser('user')
			->setPassword('password')
			->setSecure('tls')
			->setEmail('email@email.com')
			->setName('Jhon')
			->setEncode('utf8'))
);

//Driver connection AWSSES

\PHPBook\Email\Configuration\Email::setConnection('other',
	(new \PHPBook\Email\Configuration\Connection)
		->setName('Other')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook Email does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\Email\Driver\AWSSES)
			->setKey('key')
			->setSecret('secret')
			->setRegion('region')
			->setEmail('email@email.com')
			->setName('Jhon'))
);

//Driver connection MAILGUN

\PHPBook\Email\Configuration\Email::setConnection('important',
	(new \PHPBook\Email\Configuration\Connection)
		->setName('Important')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook Email does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\Email\Driver\MAILGUN)
			->setKey('key')
			->setDomain('domain')
			->setEmail('email@email.com')
			->setName('Jhon'))
);

//Driver connection SPARKPOST

\PHPBook\Email\Configuration\Email::setConnection('backups',
	(new \PHPBook\Email\Configuration\Connection)
		->setName('Backups')
		->setExceptionCatcher(function(String $message) {
			//the PHPBook Email does not throw exceptions, but you can take it here
			//you can store $message in database or something else
		})
		->setDriver((new \PHPBook\Email\Driver\SPARKPOST)
			->setKey('key')
			->setEmail('email@email.com')
			->setName('Jhon'))
);

//Set default connection by connection alias

\PHPBook\Email\Configuration\Email::setDefault('main');

//Getting connections

$connections = \PHPBook\Email\Configuration\Email::getConnections();

foreach($connections as $code => $connection) {

	$connection->getName();

	$connection->getDriver();

};

?>
```

### Sending Emails

[](#sending-emails)

```

	//Connection code is not required if you set default connection

	$boolean = (new \PHPBook\Email\Email)
		->setConnectionCode('other')
		->setMessage(
			(new \PHPBook\Email\Message)
				->setFromName('example@email.com') //custom from name. not required.
				->setFromEmail('example@email.com') //custom from email. not required.
				->setTo(['jhon@email.com'])
				->setCc(['paul@email.com'])
				->setCco(['ana@email.com'])
				->setSubject('email subject')
				->setContent('my html body')
				->setAttach([
					(new \PHPBook\Email\Attach)->setFileAlias('myfile')->setFileBuffer('my-file-buffer'),
					(new \PHPBook\Email\Attach)->setFileAlias('myfile')->setFilePath('my/file/path')
				])
		)->dispatch();

	if ($boolean) {
		//sent
	};

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~163 days

Recently: every ~225 days

Total

10

Last Release

1420d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.0.1PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31623868?v=4)[dz5362](/maintainers/phpbook)[@phpbook](https://github.com/phpbook)

---

Top Contributors

[![phpbook-sources](https://avatars.githubusercontent.com/u/34910819?v=4)](https://github.com/phpbook-sources "phpbook-sources (11 commits)")

---

Tags

phpemailfastlightweight

### Embed Badge

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

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

###  Alternatives

[garethp/php-ews

A PHP Library to interact with the Exchange SOAP service

113610.3k4](/packages/garethp-php-ews)[henrique-borba/php-sieve-manager

A modern (started in 2022) PHP library for the ManageSieve protocol (RFC5804) to create/edit Sieve scripts (RFC5228). Used by Cypht Webmail.

23125.7k2](/packages/henrique-borba-php-sieve-manager)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

14109.2k](/packages/hafael-azure-mailer-driver)[martian/spammailchecker

A laravel package that protect users from entering non-existing/spam email addresses.

422.0k](/packages/martian-spammailchecker)[naif/php-cpanel-email

Manage cPanel Email Addresses

211.3k](/packages/naif-php-cpanel-email)

PHPackages © 2026

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