PHPackages                             simp/mail - 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. simp/mail

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

simp/mail
=========

This is for sending mails

v1.0.0(1y ago)0662MITPHP

Since Jan 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/CHANCENY/mailer)[ Packagist](https://packagist.org/packages/simp/mail)[ RSS](/packages/simp-mail/feed)WikiDiscussions main Synced 1mo ago

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

Mailer Library
==============

[](#mailer-library)

Overview
--------

[](#overview)

The Mailer Library is a PHP-based solution for managing and sending emails using SMTP configurations. It includes classes for handling server settings, managing emails, and creating email envelopes. Below is a comprehensive guide to its usage.

---

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

[](#installation)

Ensure you have Composer installed. Add the library to your project by running:

```
composer require your-library-name
```

Include the autoload file in your `index.php` or main script:

```
require_once "vendor/autoload.php";
```

---

Configuration
-------------

[](#configuration)

### Server Settings

[](#server-settings)

Define your SMTP server settings using an associative array:

```
$server = [
    "host" => "smtp.gmail.com",
    "port" => 465,
    "username" => "test@gmail.com",
    "password" => "your-password"
];
```

Alternatively, you can register server settings globally using:

```
\Simp\Environment\Environment::create('mail_server_one', $server);
```

---

Usage
-----

[](#usage)

### Creating a Mail Manager

[](#creating-a-mail-manager)

Instantiate a mail manager with your server settings:

```
$mail_manager = \Simp\Mail\Mail\MailManager::mailManager(smtp_array: $server);
```

Or use globally registered server settings:

```
$mail_manager2 = \Simp\Mail\Mail\MailManager::mailManager('mail_server_one');
```

### Creating an Envelope

[](#creating-an-envelope)

An envelope represents an email to be sent. Create one as follows:

```
$envelope = \Simp\Mail\Mail\Envelope::create(
    "Testing Email",
    "Hello, this is a test emailThis is the body content."
);
$envelope->addToAddresses(["recipient@example.com"]);
```

You can create multiple envelopes if needed:

```
$envelope1 = \Simp\Mail\Mail\Envelope::create(
    "Another Test Email",
    "Another testSecond email body."
);
$envelope1->addToAddresses(["another@example.com"]);
```

### Adding Envelopes to the Mail Manager

[](#adding-envelopes-to-the-mail-manager)

Add envelopes to the mail manager for processing:

```
$mail_manager->addEnvelope($envelope);
$mail_manager2->addEnvelope($envelope1);
```

### Sending Emails

[](#sending-emails)

Process the envelopes to send emails:

```
$result = $mail_manager->processEnvelopes();
$mail_manager2->processEnvelopes();
```

---

Example
-------

[](#example)

Here is the complete example of using the library:

```
require_once "vendor/autoload.php";

$server = [
    "host" => "smtp.gmail.com",
    "port" => 465,
    "username" => "test@gmail.com",
    "password" => "your-password"
];

\Simp\Environment\Environment::create('mail_server_one', $server);

$mail_manager = \Simp\Mail\Mail\MailManager::mailManager(smtp_array: $server);
$mail_manager2 = \Simp\Mail\Mail\MailManager::mailManager('mail_server_one');

$envelope = \Simp\Mail\Mail\Envelope::create("Testing Email", "Hello this is a test emailok let see the paragraph");
$envelope->addToAddresses(["exp1@gmail.com"]);

$envelope1 = \Simp\Mail\Mail\Envelope::create("Testing Email 2", "Hello this is a test emailok let see the paragraph");
$envelope1->addToAddresses(["exp2@gmail.com"]);

$envelope2 = \Simp\Mail\Mail\Envelope::create("Testing Email 3", "Hello this is a test emailok let see the paragraph");
$envelope2->addToAddresses(["exp3@gmail.com"]);

$mail_manager->addEnvelope($envelope);
$mail_manager2->addEnvelope($envelope1);
$mail_manager2->addEnvelope($envelope2);

$result = $mail_manager->processEnvelopes();
$mail_manager2->processEnvelopes();

$envelope = \Simp\Mail\Mail\Envelope::create('Lorem ipsum dolor sit amet ', 'Lorem ipsum dolor sit amet consectetur');
$envelope->addToAddresses(['exp1@gmail.com','exp2@gmail.com']);
$envelope->addCcAddresses(['exp3@gmail.com','exp4@gmail.com']);
$envelope->addBccAddresses(['exp5@gmail.com','exp6@gmail.com']);

// Add Attachment
$envelope->addAttachment("chance.pdf", "financial-report.pdf");

$mail_manager = \Simp\Mail\Mail\MailManager::mailManager('mail_server_one');
$mail_manager->addEnvelope($envelope)->processEnvelopes();
```

---

License
-------

[](#license)

Specify the license details here.

---

Contributing
------------

[](#contributing)

Feel free to contribute by submitting issues or pull requests on GitHub.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

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

Unknown

Total

1

Last Release

475d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6097a3277a85cf902ab5d617af1515359091563d1d288dd969e59ca50646a782?d=identicon)[Chance007](/maintainers/Chance007)

---

Top Contributors

[![CHANCENY](https://avatars.githubusercontent.com/u/96126430?v=4)](https://github.com/CHANCENY "CHANCENY (2 commits)")[![maybuck](https://avatars.githubusercontent.com/u/12176638?v=4)](https://github.com/maybuck "maybuck (1 commits)")

### Embed Badge

![Health badge](/badges/simp-mail/health.svg)

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

###  Alternatives

[markguinn/silverstripe-email-helpers

Silverstripe extension containing SMTP mailer class and some other classes for HTML emails

3145.4k1](/packages/markguinn-silverstripe-email-helpers)[msp/smtp

SMTP with PHPMailer

2129.4k](/packages/msp-smtp)[doppar/framework

The Doppar Framework

366.7k8](/packages/doppar-framework)

PHPackages © 2026

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