PHPackages                             rotmailer/rotmailer - 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. rotmailer/rotmailer

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

rotmailer/rotmailer
===================

A lightweight PHP library for rotating email delivery across multiple SMTP accounts, helping bypass sending limits and improve deliverability.

v1.0.0(1y ago)117MITPHPPHP &gt;=7.0.0

Since Nov 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/phrenotype/rotmailer)[ Packagist](https://packagist.org/packages/rotmailer/rotmailer)[ RSS](/packages/rotmailer-rotmailer/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

RotMailer
=========

[](#rotmailer)

A simple PHP library that rotates email sending between multiple SMTP accounts to bypass sending limits.

Features
--------

[](#features)

- Randomized SMTP account selection for load balancing.
- Supports single and multiple recipients.
- Allows custom email content, including HTML and plain text.
- Easily configurable and extendable.

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

[](#installation)

Install the library using Composer:

```
composer require rotmailer/rotmailer
```

Requirements
------------

[](#requirements)

- PHP 7.0 or higher
- [PHPMailer](https://github.com/PHPMailer/PHPMailer)
- Enabled `ext-dom` PHP extension (required by PHPMailer)

Usage
-----

[](#usage)

### 1. Create SMTP Configuration

[](#1-create-smtp-configuration)

Define your SMTP accounts as an array of configurations:

```
$smtpConfigs = [
    [
        'host' => 'smtp.example.com',
        'username' => 'user1@example.com',
        'password' => 'password1',
        'encryption' => 'tls',
        'port' => 587,
        'from' => ['noreply@example.com', 'Example Support']
    ],
    [
        'host' => 'smtp.another.com',
        'username' => 'user2@another.com',
        'password' => 'password2',
        'encryption' => 'ssl',
        'port' => 465,
        'from' => ['noreply@another.com', 'Another Support']
    ]
];
```

### 2. Initialize `RotMailer`

[](#2-initialize-rotmailer)

Pass the SMTP configurations to the `RotMailer` class and start sending emails:

```
require 'vendor/autoload.php';

use RotMailer\RotMailer;

$mailer = new RotMailer($smtpConfigs);

try {
    $mailer->randomizeSMTP()
           ->addRecipient('recipient@example.com')
           ->setSubject('Test Email')
           ->setBody('Hello, World!')
           ->send();

    echo "Email sent successfully!";
} catch (\RuntimeException $e) {
    echo "Error: " . $e->getMessage();
}
```

API
---

[](#api)

### `__construct(array $smtpConfigs)`

[](#__constructarray-smtpconfigs)

Initializes the `RotMailer` with an array of SMTP configurations.

### `randomizeSMTP(int $debug = 0): self`

[](#randomizesmtpint-debug--0-self)

Selects a random SMTP configuration and sets it for the email. Optionally enable debugging with `$debug`.

### `setFrom(string $fromEmail, string $fromName): self`

[](#setfromstring-fromemail-string-fromname-self)

Sets the "From" address.

### `addRecipient(string $to): self`

[](#addrecipientstring-to-self)

Adds a single recipient.

### `addRecipients(array $recipients): self`

[](#addrecipientsarray-recipients-self)

Adds multiple recipients.

### `setSubject(string $subject): self`

[](#setsubjectstring-subject-self)

Sets the email subject.

### `setBody(string $body, bool $isHTML = true): self`

[](#setbodystring-body-bool-ishtml--true-self)

Sets the email body. Supports both HTML and plain text.

### `addAttachment(string $filePath, string $fileName = ''): self`

[](#addattachmentstring-filepath-string-filename---self)

Adds an attachment to the email.

### `send(): bool`

[](#send-bool)

Sends the email. Returns `true` on success or throws a `RuntimeException` on failure.

Testing
-------

[](#testing)

Run the tests using PHPUnit:

```
php vendor/bin/phpunit tests
```

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

[](#contributing)

Contributions are welcome! Please open an issue or submit a pull request with your improvements.

License
-------

[](#license)

RotMailer is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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

603d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16608743?v=4)[paulrobert](/maintainers/paulrobert)[@PaulRobert](https://github.com/PaulRobert)

---

Tags

PHP mailphp emailPHP SMTPemail libraryemail sendingsmtp rotationsmtp load balancingrotating mailersmtp accountsemail deliverability

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[getkirby/cms

The Kirby core

1.5k584.8k474](/packages/getkirby-cms)[ivantcholakov/codeigniter-phpmailer

A CodeIgniter 3 compatible email-library powered by PHPMailer.

25214.3k](/packages/ivantcholakov-codeigniter-phpmailer)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

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