PHPackages                             byjg/mailwrapper - 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. byjg/mailwrapper

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

byjg/mailwrapper
================

A lightweight wrapper for sending email. The interface is totally decoupled from the sender, providing a single interface for sending mail regardless of the underlying mail service.

6.0.0(5mo ago)550.8k↓43.5%52MITPHPPHP &gt;=8.3 &lt;8.6CI passing

Since Aug 4Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/byjg/php-mailwrapper)[ Packagist](https://packagist.org/packages/byjg/mailwrapper)[ GitHub Sponsors](https://github.com/byjg)[ RSS](/packages/byjg-mailwrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (32)Used By (2)

   sidebar\_key mailwrapper   tags    php

 email

    Mail Wrapper
============

[](#mail-wrapper)

A lightweight wrapper for sending email. The interface is totally decoupled from the sender, providing a single interface for sending mail regardless of the underlying mail service.

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/php-mailwrapper/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-mailwrapper/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/php-mailwrapper/)[![GitHub license](https://camo.githubusercontent.com/bce8695624deb827782c42301a0d270b9ad3d447935a1c94160b775f4a4d60d9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f7068702d6d61696c777261707065722e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/76ae145d6842665187d1ef3ad174cb368ed185b91d169dd2074b49afb1111255/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f7068702d6d61696c777261707065722e737667)](https://github.com/byjg/php-mailwrapper/releases/)

Available Wrappers
------------------

[](#available-wrappers)

- **SMTP** - SMTP with SSL/TLS support
- **AWS SES** - Amazon Simple Email Service (using API directly)
- **Mailgun** - Mailgun API (using API directly)
- **SendMail** - PHP's built-in mail() function
- **FakeSender** - For testing (does nothing)

Install
-------

[](#install)

```
composer require "byjg/mailwrapper"
```

Documentation
-------------

[](#documentation)

- **[Getting Started](docs/getting-started.md)** - Installation, quick start, and architecture overview
- **[Envelope](docs/envelope.md)** - Creating and configuring email messages
- **[Connection Strings](docs/connection-strings.md)** - URI patterns for different mail services (SMTP, Mailgun, SES, etc.)
- **[Mailer Factory](docs/mailer-factory.md)** - Registering and creating mailers
- **[Attachments](docs/attachments.md)** - Sending attachments and embedded images
- **[Custom Wrappers](docs/custom-wrappers.md)** - Implementing your own mail wrapper
- **[Exceptions](docs/exceptions.md)** - Error handling and exception types

Quick Start
-----------

[](#quick-start)

```
