PHPackages                             hitraa/openforge-mailer - 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. hitraa/openforge-mailer

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

hitraa/openforge-mailer
=======================

Lightweight PHP SMTP Mailer with HTML, attachments, tracking pixel, and read receipt support.

v1.0.0(10mo ago)11MITPHPPHP &gt;=8.2

Since Jun 15Pushed 10mo agoCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

📧 OpenForge Mailer - PHP SMTP Mailer
====================================

[](#-openforge-mailer---php-smtp-mailer)

[![Latest Version](https://camo.githubusercontent.com/dcf700ef601077f99b2453e1d7803fa2c9665e01e7d4eee1ef82c5a27cba6fb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6869747261612f6f70656e666f7267652d6d61696c65722e737667)](https://packagist.org/packages/hitraa/openforge-mailer)[![License](https://camo.githubusercontent.com/0b534d45bdcc8780ca0f1b21bbfe36018a046c0509fa3fda6d53fa9048a5c13f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6869747261612f6f70656e666f7267652d6d61696c6572)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/4f0ff8d47b7c73441eb92a1f49af61c2d6521b14113c8fd85fac4416c863e7cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c7565)](https://php.net)

A lightweight, dependency-free **PHP SMTP Mailer** with support for:

- 📤 Sending plain text and HTML emails
- 📎 Attachments
- 👁️‍🗨️ Tracking pixel (read/open tracking)
- ✅ SMTP-level read receipt requests (RCPT NOTIFY)
- 🛡️ TLS / SSL / STARTTLS support
- 🛠️ Fallback to native `mail()` on failure
- 🐞 Debug mode for troubleshooting

---

🚀 Features
----------

[](#-features)

- ✅ Simple API, single class
- 📦 No external dependencies
- 💬 Rich content: Plain text &amp; HTML
- 📎 Attach multiple files
- 🔒 Secure with SSL, TLS, or STARTTLS
- 👁️ Tracking pixel integration with your server
- 📨 Read receipt notification via SMTP `RCPT TO NOTIFY`
- ⛑️ Fallback to native `mail()` if SMTP fails (optional)
- 🧪 Debug output for SMTP commands

---

📘 Example Use Cases
-------------------

[](#-example-use-cases)

- ✅ Transactional email sending (invoices, alerts)
- 📢 Email marketing campaigns (with tracking)
- 📩 Application-based notifications
- 🧪 Development/testing mail delivery
- 👁️ Track when an important email is read

---

📦 Installation
--------------

[](#-installation)

Copy the `Mailer.php` file to your project.

Alternatively, if you're using Composer:

```
composer require hitraa/openforge-mailer
```

---

📁 Directory Structure
---------------------

[](#-directory-structure)

```
openforge-mailer/
├── src/
│   └── Mailer.php
├── examples/
│   ├── basic-send.php
│   └── track.php
├── composer.json
├── LICENSE
└── README.md

```

---

🚀 Usage
-------

[](#-usage)

### 1. Basic email

[](#1-basic-email)

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

use OpenForge\Mailer\Mailer;

$mail = new Mailer('smtp.yourhost.com', 'your@email.com', 'password');

$mail->setFrom('Your Name ')
     ->setRecipient('to@example.com')
     ->setSubject('Hello!')
     ->setBody('This is the plain-text version.')
     ->setHTMLBody('Hello!This is the HTML version.');

echo $mail->send();
```

---

### 2. With attachments

[](#2-with-attachments)

```
$mail->setAttachment('/path/to/file.pdf');
```

---

### 3. With tracking pixel

[](#3-with-tracking-pixel)

```
$mail->enableTrackingPixel('https://yourdomain.com/track.php');
```

> Your endpoint should log or store open events using query params like `?message_id=...&email=...`

---

### 4. SMTP read receipt (SMTP DSN) behavior

[](#4-smtp-read-receipt-smtp-dsn-behavior)

Enabling read receipts:

```
$mail->requestReadReceipt(true);
```

This adds `NOTIFY=SUCCESS,FAILURE,DELAY` in `RCPT TO`, and the recipient's mail server will notify (if supported).

Also adds optional headers:

- `Disposition-Notification-To`
- `Return-Receipt-To`
- `X-Confirm-Reading-To`

> Note: Behavior depends on recipient's server &amp; client.

---

### 5. Fallback to PHP `mail()` if SMTP fails

[](#5-fallback-to-php-mail-if-smtp-fails)

```
$mail->allowFallbackToMail(true);
```

---

### 6. With custom message id prefix

[](#6-with-custom-message-id-prefix)

```
$mail->setMessageIdPrefix('track-');
```

---

### 7. With multiple recipients

[](#7-with-multiple-recipients)

```
$mail->setRecipient(['one@example.com', 'two@example.com']);
```

---

### Parse RFC email formats

[](#parse-rfc-email-formats)

Supports:

- `Name `
- `"Name" `
- `email@example.com`

---

### 🐞 Debugging

[](#-debugging)

Enable SMTP-level debug messages:

```
$mail->enableDebug(true);
```

This will print the SMTP command flow.

---

📂 Example File
--------------

[](#-example-file)

- 📄 [`examples/basic-send.php`](examples/basic-send.php) — Full example with HTML, text, attachment.
- 📄 [`examples/track.php`](examples/track.php) — Tracking pixel handler.

---

🔐 SMTP Security Options
-----------------------

[](#-smtp-security-options)

Default portOptionDescriptionMailer constant587`tls`Default (STARTTLS)`Mailer::SECURE_TLS`465`ssl`SSL connection`Mailer::SECURE_SSL`587`starttls`Explicit STARTTLS`Mailer::SECURE_STARTTLS`---

🛡 License
---------

[](#-license)

Released under the [MIT License](LICENSE)

---

👨‍💻 Author
----------

[](#‍-author)

Made with ❤️ by **Harshal Khairnar**Founder, [Hitraa Technologies](https://hitraa.com)📧

---

🤝 Contributions
---------------

[](#-contributions)

Feel free to fork and submit pull requests. All improvements are welcome!

---

⚠️ Disclaimer
-------------

[](#️-disclaimer)

This library is designed for educational and production-ready purposes. Use responsibly when tracking user interactions.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance55

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

327d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0975c68c76f25061420d25b2a5d7288296f6b84ef68abad0f4a57435872230eb?d=identicon)[khairnar2960](/maintainers/khairnar2960)

---

Top Contributors

[![khairnar2960](https://avatars.githubusercontent.com/u/36232180?v=4)](https://github.com/khairnar2960 "khairnar2960 (2 commits)")

---

Tags

phpmailemailhtmltrackingmailersmtpopenforge

### Embed Badge

![Health badge](/badges/hitraa-openforge-mailer/health.svg)

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

###  Alternatives

[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)

PHPackages © 2026

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